代码更新

This commit is contained in:
2022-07-21 14:41:33 +08:00
parent 37b364fbb0
commit d623d8246a
5 changed files with 51 additions and 7 deletions

View File

@@ -253,6 +253,11 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void submit(JSONObject whereJson) { public void submit(JSONObject whereJson) {
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst");
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl");
JSONArray resultJSONArray = dtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(resultJSONArray)) throw new BadRequestException("维修项目为空");
JSONObject json = mstTab.query("repair_id ='" + whereJson.getString("repair_id") + "'").uniqueResult(0); JSONObject json = mstTab.query("repair_id ='" + whereJson.getString("repair_id") + "'").uniqueResult(0);
json.put("invstatus", "02"); json.put("invstatus", "02");
mstTab.update(json); mstTab.update(json);
@@ -553,30 +558,53 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
public JSONArray getFileBom(JSONObject whereJson) { public JSONArray getFileBom(JSONObject whereJson) {
String repair_item_id = whereJson.getString("repair_item_id"); String repair_item_id = whereJson.getString("repair_item_id");
String material_id = whereJson.getString("material_id"); String material_id = whereJson.getString("material_id");
String devicerecord_id = whereJson.getString("devicerecord_id");
String device_id = whereJson.getString("device_id"); String device_id = whereJson.getString("device_id");
String device_code = whereJson.getString("device_code"); String device_code = whereJson.getString("device_code");
String repair_dtl_id = whereJson.getString("repair_dtl_id"); String repair_dtl_id = whereJson.getString("repair_dtl_id");
int qty = whereJson.getIntValue("qty"); int qty = whereJson.getIntValue("qty");
WQLObject unitTab = WQLObject.getWQLObject("md_pb_measureunit");
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "'").uniqueResult(0);
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
WQLObject itemTab = WQLObject.getWQLObject("EM_BI_DeviceRepairItems"); WQLObject itemTab = WQLObject.getWQLObject("EM_BI_DeviceRepairItems");
JSONObject jsonItem = itemTab.query("repair_item_id = '" + repair_item_id + "'").uniqueResult(0); JSONObject jsonItem = itemTab.query("repair_item_id = '" + repair_item_id + "'").uniqueResult(0);
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("flag", "4"); map.put("flag", "4");
map.put("material_id", material_id); map.put("material_id", material_id);
map.put("devicerecord_id", devicerecord_id);
JSONArray fileBomArr = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).process().getResultJSONArray(0); JSONArray fileBomArr = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).process().getResultJSONArray(0);
JSONArray resultArr = new JSONArray(); JSONArray resultArr = new JSONArray();
if (ObjectUtil.isNotEmpty(fileBomArr)) { if (ObjectUtil.isNotEmpty(fileBomArr)) {
if (qty == fileBomArr.size()) { if (fileBomArr.size() < qty) {
resultArr = fileBomArr; resultArr = fileBomArr;
} else { }
int number = qty - fileBomArr.size();
for (int i = 0; i < number; i++) {
JSONObject json = fileBomArr.getJSONObject(0); JSONObject json = fileBomArr.getJSONObject(0);
for (int i = 0; i < qty; i++) { json.put("sparepart_only_id", "");
resultArr.add(json); resultArr.add(json);
} }
} else {
for (int i = 0; i < qty; i++) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("material_id",jsonMater.getString("material_id"));
jsonObject.put("material_code",jsonMater.getString("material_code"));
jsonObject.put("material_name",jsonMater.getString("material_name"));
jsonObject.put("pcsn","999999");
jsonObject.put("qty","1");
jsonObject.put("qty_unit_id",jsonUnit.getString("measure_unit_id"));
jsonObject.put("qty_unit_name",jsonUnit.getString("unit_name"));
resultArr.add(jsonObject);
} }
} }
for (int j = 0; j < resultArr.size(); j++) { for (int j = 0; j < resultArr.size(); j++) {
JSONObject jsonObject = resultArr.getJSONObject(j); JSONObject jsonObject = resultArr.getJSONObject(j);
jsonObject.put("repair_item_id", jsonItem.getString("repair_item_id")); jsonObject.put("repair_item_id", jsonItem.getString("repair_item_id"));

View File

@@ -26,6 +26,7 @@
输入.material_id TYPEAS s_string 输入.material_id TYPEAS s_string
输入.sparepart_only_id TYPEAS s_string 输入.sparepart_only_id TYPEAS s_string
输入.material_code TYPEAS s_string 输入.material_code TYPEAS s_string
输入.devicerecord_id TYPEAS s_string
[临时表] [临时表]
@@ -210,6 +211,10 @@
bom.material_id = 输入.material_id bom.material_id = 输入.material_id
ENDOPTION ENDOPTION
OPTION 输入.devicerecord_id <> ""
bom.devicerecord_id = 输入.devicerecord_id
ENDOPTION
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF

View File

@@ -66,7 +66,7 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
String classIds = classstandardService.getAllChildIdStr(class_idStr); String classIds = classstandardService.getAllChildIdStr(class_idStr);
map.put("classIds", classIds); map.put("classIds", classIds);
} }
JSONObject json = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "run.create_time DESC"); JSONObject json = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.device_code ASC,run.run_date ASC");
return json; return json;
} }

View File

@@ -174,7 +174,8 @@ export default {
'repair_item_id': this.form4.repair_item_id, 'repair_item_id': this.form4.repair_item_id,
'repair_dtl_id': this.form4.repair_dtl_id, 'repair_dtl_id': this.form4.repair_dtl_id,
'device_id': this.form4.device_id, 'device_id': this.form4.device_id,
'device_code': this.form4.device_code 'device_code': this.form4.device_code,
'devicerecord_id': this.form4.devicerecord_id
} }
crudDevicerepairmst.getFileBom(data).then(res => { crudDevicerepairmst.getFileBom(data).then(res => {
this.fileBom = res this.fileBom = res

View File

@@ -49,6 +49,16 @@
> >
导出Excel 导出Excel
</el-button> </el-button>
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-check"
size="mini"
@click="print"
>
打印
</el-button>
</crudOperation> </crudOperation>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">