fix:外协发货改批量

This commit is contained in:
zhangzhiqiang
2023-01-13 12:47:23 +08:00
parent 37b1a2e718
commit 370e6da3b4

View File

@@ -586,27 +586,29 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
if (StrUtil.isEmpty(storagevehicle_code)) {
throw new BadRequestException("载具不能为空!");
}
if (StrUtil.isEmpty(jsonObject.getString("diskrecord_id"))) {
throw new BadRequestException("组盘记录不能为空");
}
// 仓位属性表【ST_IVT_StructAttr】
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
JSONObject jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"' and diskrecord_id='"+jsonObject.getString("diskrecord_id")+"'").uniqueResult(0);
if(jo==null){
JSONArray array = PDM_BI_ProcedureOffline.query("storagevehicle_code='" + storagevehicle_code + "'").getResultJSONArray(0);
if(array==null || array.size() == 0){
throw new BadRequestException("该载具"+storagevehicle_code+"无组盘记录!");
}
String is_send = jo.getString("is_send");
if(!"1".equals(is_send)){
throw new BadRequestException("该载具"+storagevehicle_code+"状态不是已出库状态,不允许发货!");
List<String> diskrecordIds = new ArrayList<>();
for (Object o : array) {
JSONObject jo = (JSONObject) o;
String is_send = jo.getString("is_send");
if(!"1".equals(is_send)){
throw new BadRequestException("该载具"+storagevehicle_code+"状态不是已出库状态,不允许发货!");
}
diskrecordIds.add(jo.getString("diskrecord_id"));
}
String diskrecord_id = jsonObject.getString("diskrecord_id");
HashMap<String,String> map = new HashMap<String,String>();
map.put("is_send","2");
map.put("send_id",currentUserId+"");
map.put("send_name",userDto.getNickName());
map.put("send_time",DateUtil.now());
PDM_BI_ProcedureOffline.update(map,"diskrecord_id='"+diskrecord_id+"'");
String collect = diskrecordIds.stream().collect(Collectors.joining("','"));
PDM_BI_ProcedureOffline.update(map,"diskrecord_id in ('"+collect+"')");
}
JSONObject returnjo = new JSONObject();