| | |
| | | import zy.cloud.wms.manager.service.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | /** |
| | | * 控管 |
| | | */ |
| | | if (Cools.isEmpty(item.getHostId()) || item.getHostId() == 0){ |
| | | item.setHostId(1L); |
| | | } |
| | | |
| | | if (Cools.isEmpty(item)) { |
| | | return R.error("参数为空,请联系管理员"); |
| | | } |
| | |
| | | if (!Cools.isEmpty(name)) { |
| | | throw new CoolException("不可有重复项目名"); |
| | | } |
| | | if (item.getRealMonth() < 0){ |
| | | throw new CoolException("实施周期不可为负数"); |
| | | } |
| | | // if (item.getRealMonth() < 0){ |
| | | // throw new CoolException("实施周期不可为负数"); |
| | | // } |
| | | if (Cools.isEmpty(item.getCstmrUuid())) { |
| | | throw new CoolException("请选择客户"); |
| | | } |
| | |
| | | item.setCustMan(cstmr.getName()); |
| | | item.setCustMobile(cstmr.getTel()); |
| | | item.setCustAdress(cstmr.getAddr()); |
| | | item.setHostId(getHostId()); |
| | | if (Cools.isEmpty(item.getHostId()) || item.getHostId() == 0){ |
| | | item.setHostId(1L); |
| | | }else { |
| | | item.setHostId(getHostId()); |
| | | } |
| | | item.setCreateBy(getUserId()); |
| | | item.setCreateTime(new Date()); |
| | | item.setStatus(1); |
| | | item.setUpdateBy(getUserId()); |
| | | item.setUpdateTime(new Date()); |
| | | Long span = (item.getEndTime().getTime() - item.getStartTime().getTime()) / 1000 / 60 / 60 / 24; |
| | | item.setRealMonth(Math.toIntExact(span)); |
| | | itemService.insertAll(item); |
| | | return R.ok(); |
| | | } |
| | |
| | | // if (item.getRealMonth() < 0){ |
| | | // throw new CoolException("实施周期不可为负数"); |
| | | // } |
| | | if(!(newitem.getStartTime()==null || newitem.getEndTime()==null || newitem.getRealStartTime()==null || newitem.getRealEndTime()==null)){ |
| | | item.setStartTime(newitem.getStartTime()); |
| | | item.setEndTime(newitem.getEndTime()); |
| | | item.setRealEndTime(newitem.getRealEndTime()); |
| | | item.setRealStartTime(newitem.getRealStartTime()); |
| | | } |
| | | |
| | | |
| | | //↓↓↓写这段代码的真该抽大嘴巴子 |
| | | // if(!(newitem.getStartTime()==null || newitem.getEndTime()==null || newitem.getRealStartTime()==null || newitem.getRealEndTime()==null)){ |
| | | // item.setStartTime(newitem.getStartTime()); |
| | | // item.setEndTime(newitem.getEndTime()); |
| | | // item.setRealEndTime(newitem.getRealEndTime()); |
| | | // item.setRealStartTime(newitem.getRealStartTime()); |
| | | // } |
| | | |
| | | |
| | | //超出运费 |
| | | if(item.getPlandeAmt()!=null && item.getRealdeAmt()!=null){ |
| | | item.setExcessAmount(item.getRealdeAmt()-item.getPlandeAmt()); |
| | |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping("/item/initAll") |
| | | public R initAll() { |
| | | List<Item> items = itemService.selectList(null); |
| | | for (Item item : items) { |
| | | Integer isAsrs = item.getType().equals("10")? 1: 0; |
| | | List<FlowStatus> allTypes = flowStatusService.selectList(new EntityWrapper<FlowStatus>() |
| | | .eq("is_asrs", isAsrs) |
| | | .orderBy("weight_num",true)); |
| | | for (FlowStatus oneType : allTypes) { |
| | | ProjectPlan projectPlan = new ProjectPlan(); |
| | | projectPlan.setItemId(item.getId()); |
| | | projectPlan.setWeightNum(oneType.getWeightNum()); |
| | | projectPlan.setFlowId(oneType.getId()); |
| | | projectPlan.setCreateId(item.getCreateBy()); |
| | | projectPlan.setCreateTime(item.getCreateTime()); |
| | | projectPlan.setModifyId(item.getUpdateBy()); |
| | | projectPlan.setModifyTime(item.getUpdateTime()); |
| | | planService.insert(projectPlan); |
| | | } |
| | | } |
| | | return R.ok("共计插入:"+items.size()+"条数据"); |
| | | } |
| | | } |