理化报告同步

This commit is contained in:
2022-09-13 14:08:20 +08:00
parent d0ddc6cf68
commit 3c772a7850
3 changed files with 166 additions and 120 deletions

View File

@@ -606,7 +606,9 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
sheetDtlTab.update(jsonSheetDtl);
// 调用质检单中的确认
inspectionsheetmstService.confirm(jsonSheetDtl);
} else {throw new BadRequestException("物料类型错误");}
} else {
throw new BadRequestException("物料类型错误");
}
} else if (StrUtil.equals(result, "02")) {
// 不合格
/*
@@ -998,34 +1000,38 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
for (int i = 0; i < dataArr.size(); i++) {
JSONObject json = dataArr.getJSONObject(i);
// 1.将erp物料id转换成本系统物料id
String ext_id = json.getString("material_id");
JSONObject jsonMater = materTab.query("ext_id = '" + ext_id + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料"+ext_id+"在mes系统不存在");
String material_id = jsonMater.getString("material_id");
String pcsn = json.getString("pcsn");
// 2.根据物料、批次查询理化报告单 查询是否有此物料、批次的理化报告
JSONObject jsonPhyMst = phyMstTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and is_delete = '0'").uniqueResult(0);
// 3.如果理化报告不存在则是有问题 先跳过不做处理
if (ObjectUtil.isEmpty(jsonPhyMst)) continue;
JSONObject jsonPhyMst = phyMstTab.query("inspection_id = '"+json.getString("inspection_id")+"'").uniqueResult(0);
if (StrUtil.equals(jsonPhyMst.getString("bill_status"), "99")) {
throw new BadRequestException("此理化报告:" + jsonPhyMst.getString("inspection_code") + "已完成");
}
// 1.将wms物料id转换成本erp物料id
String material_id = json.getString("material_id");
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料" + material_id + "在mes系统不存在");
String pcsn = json.getString("pcsn");
// 2.根据物料、批次查询erp系统中是否存在此批次的理化报告
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("ext_id", jsonMater.getString("ext_id"));
map.put("pcsn", pcsn);
JSONObject jsonErp = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonErp)) continue;
// 4.更新理化报告主表
jsonPhyMst.put("result", json.getString("check_result"));
jsonPhyMst.put("result", jsonErp.getString("check_result"));
jsonPhyMst.put("grade", "01");
jsonPhyMst.put("other_device_no", json.getString("other_device_no"));
jsonPhyMst.put("other_device_wd", json.getString("other_device_wd"));
jsonPhyMst.put("weightlost", json.getString("weightlost"));
jsonPhyMst.put("remark", json.getString("remark"));
jsonPhyMst.put("other_device_no", jsonErp.getString("other_device_no"));
jsonPhyMst.put("other_device_wd", jsonErp.getString("other_device_wd"));
jsonPhyMst.put("weightlost", jsonErp.getString("weightlost"));
jsonPhyMst.put("remark", jsonErp.getString("remark"));
jsonPhyMst.put("bill_status", "30");
phyMstTab.update(jsonPhyMst);
// 5.根据erp项点 插入理化报告明细 调用createPhyDtl()
json.put("inspection_id", jsonPhyMst.getString("inspection_id"));
this.createPhyDtl(json);
jsonErp.put("inspection_id", jsonPhyMst.getString("inspection_id"));
this.createPhyDtl(jsonErp);
// 6.确认单据
this.confirm(jsonPhyMst);
}
@@ -1034,6 +1040,7 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
/**
* 查询理化质检检测项点 公共方法
*
* @param item_code: 项点编码 /
* @return json
*/
@@ -1046,6 +1053,7 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
/**
* 根据erp项点插入理化报告明细
*
* @param json /
*/
@Transactional(rollbackFor = Exception.class)

View File

@@ -14,8 +14,8 @@
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.search_material_code TYPEAS s_string
输入.search_pcsn TYPEAS s_string
输入.ext_id TYPEAS s_string
输入.pcsn TYPEAS s_string
[临时表]
@@ -63,20 +63,45 @@
ENDIF
IF 输入.flag = "2"
PAGEQUERY
QUERY
SELECT
*
FROM
QL_TEST_PHYSICAL
where
is_effective = '1'
AND dr = '0'
OPTION 输入.search_material_code <> ""
'material_code' like 输入.search_material_code
OPTION 输入.ext_id <> ""
material_id = 输入.ext_id
ENDOPTION
OPTION 输入.search_pcsn <> ""
'pcsn' like 输入.search_pcsn
OPTION 输入.pcsn <> ""
pcsn = 输入.pcsn
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
*
FROM
QL_TEST_PHYSICAL
where
'is_effective' = '1'
AND 'dr' = '0'
OPTION 输入.ext_id <> ""
'material_id' = 输入.ext_id
ENDOPTION
OPTION 输入.pcsn <> ""
'pcsn' = 输入.pcsn
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -150,7 +150,7 @@
type="success"
icon="el-icon-refresh"
size="mini"
@click="phySyncShow = true"
@click="phySync"
>
理化同步
</el-button>
@@ -252,7 +252,7 @@
<MaterDtl :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @tableChanged2="tableChanged2" />
<Dialog1 :visiable1.sync="visiable1" :inspection-id="inspection_id" />
<RelevancyDialog :dialog-show.sync="RelevancyShow" @RelevancyChanged="RelevancyChanged" />
<PhySyncDialog :dialog-show.sync="phySyncShow" />
<!-- <PhySyncDialog :dialog-show.sync="phySyncShow" />-->
</div>
</template>
@@ -432,6 +432,19 @@ export default {
this.crud.notify('设置成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
phySync() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0) {
return this.crud.notify('请至少选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
}
const data = {
'data': _selectData
}
crudPhysicalMst.hpySync(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
}
}
}