opt:优化领料单和生成入库单批号,辅助单位,手工录入等情况数据发送
This commit is contained in:
@@ -25,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -63,31 +65,8 @@ public class SyncReceiptProcessHandler implements ClassProcess {
|
|||||||
if (StringUtils.isEmpty(formid)) {
|
if (StringUtils.isEmpty(formid)) {
|
||||||
throw new BadRequestException("回传失败:回传数据form_data中数据格式不是formid,data类型");
|
throw new BadRequestException("回传失败:回传数据form_data中数据格式不是formid,data类型");
|
||||||
}
|
}
|
||||||
//判断生产入库的手工录入与MRP生成方式需回传不同的源单信息
|
|
||||||
// if ("0".equals(formData.getString("FSrcEntryId")) && "PRD_INSTOCK".equals(formType)) {
|
handleBillEntity(pmFormData.getForm_type(), formData);
|
||||||
// //查询工序汇报单
|
|
||||||
// ErpQuery reportQuery = new ErpQuery();
|
|
||||||
// reportQuery.setFilterString("FMoNumber ='" + formData.getString("moNumber") + "'");
|
|
||||||
// reportQuery.setOrderString("FId desc");
|
|
||||||
// reportQuery.setFormId("SFC_OperationReport");
|
|
||||||
// JSONArray jsonArray = erpServiceUtils.queryBills(reportQuery);
|
|
||||||
// formData.remove("FSrcEntryId");
|
|
||||||
// formData.put("FSrcBillNo", jsonArray.getJSONObject(0).getString("BillNo"));
|
|
||||||
// }
|
|
||||||
// if ("PRD_PickMtrl".equals(formType)) {
|
|
||||||
// List<MdMeMaterialbase> materialList = iMdMeMaterialbaseService.list(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_id, formData.getString("material_id")));
|
|
||||||
// if (ObjectUtils.isNotEmpty(materialList)) {
|
|
||||||
// MdMeMaterialbase materialInfo = materialList.get(0);
|
|
||||||
// //没有启用批次号
|
|
||||||
// if ("0".equals(materialInfo.getPrint_no())) {
|
|
||||||
// formData.remove("FLot");
|
|
||||||
// }
|
|
||||||
// //辅助单位
|
|
||||||
// if (!"0".equals(materialInfo.getAssist_unit_id())) {
|
|
||||||
// formData.put("FSecUnitId", materialInfo.getAssist_unit_id());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
String json = formData.toJSONString();
|
String json = formData.toJSONString();
|
||||||
try {
|
try {
|
||||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||||
@@ -124,12 +103,78 @@ public class SyncReceiptProcessHandler implements ClassProcess {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LambdaUpdateWrapper<PmFormData> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<PmFormData> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(PmFormData::getId, pmFormData.getId());
|
updateWrapper.eq(PmFormData::getId, pmFormData.getId());
|
||||||
updateWrapper.set(PmFormData::getRemark, "回执单创建失败,原因为:"+ex.getMessage() + ",回传Erp数据为:" + json);
|
updateWrapper.set(PmFormData::getRemark, "回执单创建失败,原因为:" + ex.getMessage() + ",回传Erp数据为:" + json);
|
||||||
iPmFormDataService.update(updateWrapper);
|
iPmFormDataService.update(updateWrapper);
|
||||||
Log.error(ex.getMessage());
|
Log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleBillEntity(String formType, JSONObject formData) {
|
||||||
|
JSONArray fEntityArray = formData.getJSONObject("Model").getJSONArray("FEntity");
|
||||||
|
//判断生产入库的手工录入与MRP生成方式需回传不同的源单信息
|
||||||
|
if ("0".equals(formData.getString("FSrcEntryId")) && "PRD_INSTOCK".equals(formType)) {
|
||||||
|
//查询工序汇报单
|
||||||
|
ErpQuery reportQuery = new ErpQuery();
|
||||||
|
reportQuery.setFilterString("FMoNumber ='" + formData.getString("moNumber") + "'");
|
||||||
|
reportQuery.setOrderString("FId desc");
|
||||||
|
reportQuery.setFormId("SFC_OperationReport");
|
||||||
|
JSONArray jsonArray = erpServiceUtils.queryBills(reportQuery);
|
||||||
|
for (int i = 0; i < fEntityArray.size(); i++) {
|
||||||
|
JSONObject fEntity = fEntityArray.getJSONObject(i);
|
||||||
|
if (fEntity.containsKey("FSrcEntryId")) {
|
||||||
|
fEntity.remove("FSrcEntryId");
|
||||||
|
}
|
||||||
|
Map<String, Object> linkedMap = new LinkedHashMap<>();
|
||||||
|
for (String key : fEntity.keySet()) {
|
||||||
|
linkedMap.put(key, fEntity.get(key));
|
||||||
|
}
|
||||||
|
Map<String, Object> tempMap = new LinkedHashMap<>();
|
||||||
|
for (Map.Entry<String, Object> entry : linkedMap.entrySet()) {
|
||||||
|
tempMap.put(entry.getKey(), entry.getValue());
|
||||||
|
if ("FMoEntryId".equals(entry.getKey())) {
|
||||||
|
//源单编号为工序汇报单号
|
||||||
|
tempMap.put("FSrcBillNo", jsonArray.getJSONObject(0).getString("BillNo"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fEntity.clear();
|
||||||
|
fEntity.putAll(tempMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//判断生产领料单的批次与辅助单位
|
||||||
|
if ("PRD_PickMtrl".equals(formType)) {
|
||||||
|
for (int i = 0; i < fEntityArray.size(); i++) {
|
||||||
|
List<MdMeMaterialbase> materialList = iMdMeMaterialbaseService.list(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_id, formData.getString("material_id")));
|
||||||
|
MdMeMaterialbase materialInfo = materialList.get(0);
|
||||||
|
JSONObject fEntity = fEntityArray.getJSONObject(i);
|
||||||
|
//没有启用批次号
|
||||||
|
if ("0".equals(materialInfo.getPrint_no())) {
|
||||||
|
if (fEntity.containsKey("FLot")) {
|
||||||
|
fEntity.remove("FLot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//辅助单位
|
||||||
|
Map<String, Object> linkedMap = new LinkedHashMap<>();
|
||||||
|
for (String key : fEntity.keySet()) {
|
||||||
|
linkedMap.put(key, fEntity.get(key));
|
||||||
|
}
|
||||||
|
Map<String, Object> tempMap = new LinkedHashMap<>();
|
||||||
|
for (Map.Entry<String, Object> entry : linkedMap.entrySet()) {
|
||||||
|
tempMap.put(entry.getKey(), entry.getValue());
|
||||||
|
if (!"0".equals(materialInfo.getAssist_unit_id()) && "FUnitID".equals(entry.getKey())) {
|
||||||
|
JSONObject fUnit = new JSONObject();
|
||||||
|
fUnit.put("FNumber", materialInfo.getAssist_unit_id());
|
||||||
|
tempMap.put("FSecUnitId", fUnit);
|
||||||
|
}
|
||||||
|
if ("FStockId".equals(entry.getKey())) {
|
||||||
|
JSONObject fStockId = new JSONObject();
|
||||||
|
fStockId.put("FNumber", "25");
|
||||||
|
linkedMap.put("FStockId", fStockId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fEntity.clear();
|
||||||
|
fEntity.putAll(tempMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ public class PdaIOService {
|
|||||||
if (ObjectUtils.isNotEmpty(lists)) {
|
if (ObjectUtils.isNotEmpty(lists)) {
|
||||||
List<Object> dataList = lists.get(0);
|
List<Object> dataList = lists.get(0);
|
||||||
if (ObjectUtils.isNotEmpty(dataList)) {
|
if (ObjectUtils.isNotEmpty(dataList)) {
|
||||||
//查询生产订单信息
|
//查询本地生产订单信息
|
||||||
ReceiveBillData prdMoBillData = pmFormDataMapper.queryOrderStockId(dataList.get(11).toString(),dataList.get(12).toString());
|
ReceiveBillData prdMoBillData = pmFormDataMapper.queryOrderStockId(dataList.get(11).toString(),dataList.get(12).toString());
|
||||||
if (prdMoBillData == null) {
|
if (prdMoBillData == null) {
|
||||||
throw new BadRequestException("查询合格证关联的生产订单信息异常!");
|
throw new BadRequestException("查询合格证关联的生产订单信息异常!");
|
||||||
|
|||||||
@@ -182,10 +182,19 @@
|
|||||||
<el-input v-model="form.bar_code" style="width: 150px;" />
|
<el-input v-model="form.bar_code" style="width: 150px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item label="自定义字段" prop="form_param">
|
<el-form-item label="自定义字段" prop="form_param">
|
||||||
<el-input v-model="form.form_param" type="textarea" :formatter="jsonFormat" style="width: 430px;" />
|
<el-input v-model="form.form_param" type="textarea" :formatter="jsonFormat" style="width: 430px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否自动同步" prop="has_child">
|
||||||
|
<el-radio-group v-model="form.is_sync" style="width: 140px">
|
||||||
|
<el-radio :label="true">是</el-radio>
|
||||||
|
<el-radio :label="false">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
@@ -226,6 +235,7 @@
|
|||||||
<el-table-column prop="form_param" show-overflow-tooltip width="120" :formatter="jsonFormat" label="自定义字段映射" />
|
<el-table-column prop="form_param" show-overflow-tooltip width="120" :formatter="jsonFormat" label="自定义字段映射" />
|
||||||
<el-table-column prop="update_time" show-overflow-tooltip width="150" label="更新时间" />
|
<el-table-column prop="update_time" show-overflow-tooltip width="150" label="更新时间" />
|
||||||
<el-table-column prop="update_name" show-overflow-tooltip width="150" label="更新人" />
|
<el-table-column prop="update_name" show-overflow-tooltip width="150" label="更新人" />
|
||||||
|
<el-table-column prop="is_sync" show-overflow-tooltip width="120" :formatter="booleanFormat" label="是否自动同步" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="操作"
|
label="操作"
|
||||||
width="120px"
|
width="120px"
|
||||||
@@ -283,6 +293,7 @@ const defaultForm = {
|
|||||||
form_param: null,
|
form_param: null,
|
||||||
has_child: false,
|
has_child: false,
|
||||||
is_base: false,
|
is_base: false,
|
||||||
|
is_sync: false,
|
||||||
parent_id: null,
|
parent_id: null,
|
||||||
convert_json: null,
|
convert_json: null,
|
||||||
bus_data: null
|
bus_data: null
|
||||||
|
|||||||
Reference in New Issue
Block a user