代码更新

This commit is contained in:
2022-10-28 18:27:29 +08:00
parent db76b45884
commit 0ed94f6aaf
6 changed files with 89 additions and 3 deletions

View File

@@ -111,4 +111,12 @@ public class PointController {
pointService.changeLock(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("仓位同步")
@PostMapping("/sync")
@ApiOperation("仓位同步")
public ResponseEntity<Object> sync() {
pointService.sync();
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -96,4 +96,9 @@ public interface PointService {
* @param jsonObject
*/
void changeLock(JSONObject jsonObject);
/**
* 仓位同步
*/
void sync();
}

View File

@@ -301,6 +301,51 @@ public class PointServiceImpl implements PointService {
}
}
@Override
@Transactional
public void sync() {
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
// 先删除所有点位类型为仓位的点位
WQLObject.getWQLObject("sch_base_point").delete(" point_type = '01'");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject map = new JSONObject();
map.put("flag", "2");
JSONArray arrStruct = WQL.getWO("QSCH_BASE_POINT").addParamMap(map).process().getResultJSONArray(0);
for (int i = 0; i < arrStruct.size(); i++) {
JSONObject json = arrStruct.getJSONObject(i);
JSONObject structMap = new JSONObject();
structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId());
structMap.put("point_code", json.getString("struct_code"));
structMap.put("point_name", json.getString("struct_name"));
structMap.put("region_id", "");
structMap.put("region_code", "");
structMap.put("region_name", "");
structMap.put("point_type", "01");
structMap.put("point_status", "00");
structMap.put("lock_type", "1");
structMap.put("block_num", json.getIntValue("block_num"));
structMap.put("row_num", json.getIntValue("row_num"));
structMap.put("col_num", json.getIntValue("col_num"));
structMap.put("layer_num", json.getIntValue("layer_num"));
structMap.put("source_id", json.getString("struct_id"));
structMap.put("create_id", currentUserId);
structMap.put("create_name", nickName);
structMap.put("create_time", now);
structMap.put("update_optid", currentUserId);
structMap.put("update_optname", nickName);
structMap.put("update_time", now);
wo.insert(structMap);
}
}
//根据重量返回最大的 级数
public String getLoadSeriesByqty(Double qty) {
JSONArray dictArr = WQLObject.getWQLObject("sys_dict_detail").query("dict_id ='108'", "label").getResultJSONArray(0);