Compare commits
3 Commits
3224baa0cf
...
ae1c303ed9
Author | SHA1 | Date |
---|---|---|
xd | ae1c303ed9 | |
xd | 61bc95f676 | |
xd | 2b71871743 |
2
pom.xml
2
pom.xml
|
@ -18,7 +18,7 @@
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
<druid.version>1.2.20</druid.version>
|
<druid.version>1.2.21</druid.version>
|
||||||
<bitwalker.version>1.21</bitwalker.version>
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
<swagger.version>3.0.0</swagger.version>
|
<swagger.version>3.0.0</swagger.version>
|
||||||
<kaptcha.version>2.3.3</kaptcha.version>
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
|
|
|
@ -109,4 +109,25 @@ public class CYlMaterialController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(cYlMaterialService.deleteCYlMaterialByMaterialIds(materialIds));
|
return toAjax(cYlMaterialService.deleteCYlMaterialByMaterialIds(materialIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步更细报价实时价格
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('clMaterial:clMaterial:synchronizeQuotationData')")
|
||||||
|
@Log(title = "同步更细报价实时价格", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/synchronizeUpdate")
|
||||||
|
public AjaxResult synchronizeUpdate()
|
||||||
|
{
|
||||||
|
//拉取9.2 jn_erp 报价实时价格数据,保存至 c_yl_material_bjdata 表
|
||||||
|
List<CYlMaterial> list = cYlMaterialService.getBjData();
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
cYlMaterialService.deleteYlMaterialBjBatch();
|
||||||
|
cYlMaterialService.insertYlMaterialBjBatch(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据执行sql 更新 c_yl_material_bjdata 表中单价字段
|
||||||
|
cYlMaterialService.updateYlMaterialBjBatch();
|
||||||
|
|
||||||
|
return success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,20 @@ spring:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
enabled: true
|
enabled: true
|
||||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
|
# 测试数据库
|
||||||
|
# url: jdbc:sqlserver://192.168.9.66:1433;DatabaseName=jn_quot
|
||||||
|
# 正式数据库
|
||||||
url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot
|
url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot
|
||||||
username: sa
|
username: sa
|
||||||
password: Itcenter110-
|
password: Itcenter110-
|
||||||
|
# 江南erp数据库数据源
|
||||||
|
jnerp:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
enabled: true
|
||||||
|
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
|
url: jdbc:sqlserver://192.168.9.2:1433;DatabaseName=jn_erp
|
||||||
|
username: sa
|
||||||
|
password: it12345
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 10
|
initialSize: 10
|
||||||
# 最小连接池数量
|
# 最小连接池数量
|
||||||
|
|
|
@ -20,6 +20,11 @@ public enum DataSourceType
|
||||||
/**
|
/**
|
||||||
* 江南全要素报价数据库
|
* 江南全要素报价数据库
|
||||||
*/
|
*/
|
||||||
QUOT
|
QUOT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江南ERP数据库
|
||||||
|
*/
|
||||||
|
JNERP
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,15 @@ public class DruidConfig
|
||||||
return druidProperties.dataSource(dataSource);
|
return druidProperties.dataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.jnerp")
|
||||||
|
@ConditionalOnProperty(prefix = "spring.datasource.druid.jnerp", name = "enabled", havingValue = "true")
|
||||||
|
public DataSource jnerpDataSource(DruidProperties druidProperties)
|
||||||
|
{
|
||||||
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean(name = "dynamicDataSource")
|
@Bean(name = "dynamicDataSource")
|
||||||
@Primary
|
@Primary
|
||||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
public DynamicDataSource dataSource(DataSource masterDataSource)
|
||||||
|
@ -66,6 +75,7 @@ public class DruidConfig
|
||||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||||
setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource");
|
setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource");
|
||||||
setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource");
|
setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource");
|
||||||
|
setDataSource(targetDataSources, DataSourceType.JNERP.name(), "jnerpDataSource");
|
||||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,4 +65,26 @@ public interface CYlMaterialMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
CYlMaterial checkMaterialNoUnique(String materialNo);
|
CYlMaterial checkMaterialNoUnique(String materialNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取报价实时价格数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CYlMaterial> getBjData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除c_yl_material_bjdata 表数据
|
||||||
|
*/
|
||||||
|
void deleteYlMaterialBjBatch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价实时价格数据保存至 c_yl_material_bjdata 表
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
void insertYlMaterialBjBatch(List<CYlMaterial> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 c_yl_material_bjdata 表中单价字段
|
||||||
|
*/
|
||||||
|
void updateYlMaterialBjBatch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,26 @@ public interface ICYlMaterialService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean checkMaterialNoUnique(CYlMaterial cYlMaterial);
|
boolean checkMaterialNoUnique(CYlMaterial cYlMaterial);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取报价实时价格数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CYlMaterial> getBjData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除c_yl_material_bjdata 表数据
|
||||||
|
*/
|
||||||
|
void deleteYlMaterialBjBatch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价实时价格数据保存至 c_yl_material_bjdata 表
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
void insertYlMaterialBjBatch(List<CYlMaterial> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 c_yl_material_bjdata 表中单价字段
|
||||||
|
*/
|
||||||
|
void updateYlMaterialBjBatch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@ package com.ruoyi.clMaterial.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.DataSource;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -110,4 +112,44 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService
|
||||||
}
|
}
|
||||||
return UserConstants.UNIQUE;
|
return UserConstants.UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取报价实时价格数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataSource(DataSourceType.JNERP)
|
||||||
|
public List<CYlMaterial> getBjData() {
|
||||||
|
|
||||||
|
List<CYlMaterial> list = cYlMaterialMapper.getBjData();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除c_yl_material_bjdata 表数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataSource(DataSourceType.QUOT)
|
||||||
|
public void deleteYlMaterialBjBatch() {
|
||||||
|
cYlMaterialMapper.deleteYlMaterialBjBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价实时价格数据保存至 c_yl_material_bjdata 表
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataSource(DataSourceType.QUOT)
|
||||||
|
public void insertYlMaterialBjBatch(List<CYlMaterial> list) {
|
||||||
|
cYlMaterialMapper.insertYlMaterialBjBatch(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 c_yl_material_bjdata 表中单价字段
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataSource(DataSourceType.QUOT)
|
||||||
|
public void updateYlMaterialBjBatch() {
|
||||||
|
cYlMaterialMapper.updateYlMaterialBjBatch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo}
|
select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getBjData" resultType="CYlMaterial">
|
||||||
|
SELECT A.m_id_0 materialNo,A.m_name_0 materialName,
|
||||||
|
case when isnull(CONVERT(decimal(10,2), C.XLXSCLHQ_HSJG),0)=0 then A.m_price_0 else CONVERT(decimal(10,2), C.XLXSCLHQ_HSJG) end materialPrice
|
||||||
|
from aq_base_material A left join c_user B on A.create_user_uid_0=B.uid_0
|
||||||
|
left join (
|
||||||
|
select REPLACE(REPLACE(REPLACE(XLXSBJCL_BJCLID,char(10),''),CHAR(13),''),CHAR(32),'')
|
||||||
|
as XLXSCLHQ_BJCLID,XLXSBJCL_BJCLMC,
|
||||||
|
isnull(XLXSCLHQ_HSJG,0.0)as XLXSCLHQ_HSJG,
|
||||||
|
isnull(XLXSCLHQ_WHR,' ')as XLXSCLHQ_WHR,XLXSCLHQ_WHSJ
|
||||||
|
from [BJ].[GTDB8].[JSERP8].XLXSBJCL
|
||||||
|
left join [BJ].[GTDB8].[JSERP8].XLXSCLHQ on XLXSCLHQ_JGBID=(select xlxsjgb_JGBID
|
||||||
|
from [BJ].[GTDB8].[JSERP8].xlxsjgb
|
||||||
|
where xlxsjgb_tjys='3 '
|
||||||
|
and XLXSJGB_YXQS <![CDATA[<=]]> rtrim(convert(char,getdate(),20))
|
||||||
|
and (XLXSJGB_YXQZ is null or XLXSJGB_YXQZ>=rtrim(convert(char,getdate(),20))))
|
||||||
|
and XLXSCLHQ_BJCLID=XLXSBJCL_BJCLID
|
||||||
|
where 1=1
|
||||||
|
) C on C.XLXSCLHQ_BJCLID = A.bjm_id_0 order by A.m_id_0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteYlMaterialBjBatch">
|
||||||
|
delete from c_yl_material_bjdata
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertYlMaterialBjBatch">
|
||||||
|
INSERT INTO c_yl_material_bjdata (material_bj_no, material_bj_name, material_bj_price)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" index="" item="t" separator=",">
|
||||||
|
(#{t.materialNo,jdbcType=VARCHAR},
|
||||||
|
#{t.materialName,jdbcType=VARCHAR},
|
||||||
|
cast(#{t.materialPrice,jdbcType=DECIMAL} as decimal(18,2)))
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateYlMaterialBjBatch">
|
||||||
|
update c_yl_material set material_name = a.material_bj_name,material_price=a.material_bj_price
|
||||||
|
from c_yl_material_bjdata a where a.material_bj_no = material_no
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -42,3 +42,11 @@ export function delClMaterial(materialId) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//同步更细报价实时价格
|
||||||
|
export function synchronizeUpdate() {
|
||||||
|
return request({
|
||||||
|
url: '/clMaterial/clMaterial/synchronizeUpdate',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -76,6 +76,16 @@
|
||||||
v-hasPermi="['clMaterial:clMaterial:export']"
|
v-hasPermi="['clMaterial:clMaterial:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-refresh-right"
|
||||||
|
size="mini"
|
||||||
|
@click="handleSynchronize"
|
||||||
|
v-hasPermi="['clMaterial:clMaterial:synchronizeQuotationData']"
|
||||||
|
>同步更新报价</el-button>
|
||||||
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
@ -150,7 +160,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listClMaterial, getClMaterial, delClMaterial, addClMaterial, updateClMaterial } from "@/api/clMaterial/clMaterial";
|
import { listClMaterial, getClMaterial, delClMaterial, addClMaterial, updateClMaterial, synchronizeUpdate } from "@/api/clMaterial/clMaterial";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ClMaterial",
|
name: "ClMaterial",
|
||||||
|
@ -308,6 +318,16 @@ export default {
|
||||||
/** 序号 */
|
/** 序号 */
|
||||||
rowClMaterialIndex({ row, rowIndex }) {
|
rowClMaterialIndex({ row, rowIndex }) {
|
||||||
row.index = rowIndex + 1;
|
row.index = rowIndex + 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/*同步更新报价实时价格*/
|
||||||
|
handleSynchronize(){
|
||||||
|
this.$modal.confirm('是否确认同步更新?').then(function() {
|
||||||
|
return synchronizeUpdate();
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("更新成功");
|
||||||
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -308,10 +308,10 @@ export default {
|
||||||
{ required: true, message: "类别不能为空", trigger: "blur" }
|
{ required: true, message: "类别不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
costClQty: [
|
costClQty: [
|
||||||
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,5})?$/, message: '格式有误',trigger: "blur"}
|
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,4})?$/, message: '格式有误',trigger: "blur"}
|
||||||
],
|
],
|
||||||
costClQty2: [
|
costClQty2: [
|
||||||
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,5})?$/, message: '格式有误',trigger: "blur"}
|
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,4})?$/, message: '格式有误',trigger: "blur"}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue