| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.WaitPakinService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class WaitPakinController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @RequestMapping(value = "/waitPakin/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | |
| | | @RequestMapping(value = "/waitPakin/delete/auth") |
| | | @ManagerAuth |
| | | @Transactional |
| | | public R delete(@RequestParam String param){ |
| | | List<WaitPakin> list = JSONArray.parseArray(param, WaitPakin.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | return R.error("数据为空"); |
| | | } |
| | | //通过HashSet的非重复特性, 存储不同的order编号, 然后遍历,将符合条件的order状态恢复到待处理 |
| | | HashSet<String> orderNos = new HashSet<>(); |
| | | for (WaitPakin entity : list){ |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("barcode", entity.getZpallet())); |
| | | if(!Cools.isEmpty(wrkMasts) || wrkMasts.size() > 0){ |
| | | return R.error("条码已生成入库工作档,禁止删除"); |
| | | } |
| | | waitPakinService.delete(new EntityWrapper<>(entity)); |
| | | //订单关联,修改订单作业数量 |
| | | if (!Cools.isEmpty(entity.getOrderNo())) { |
| | | if (!orderDetlService.decrease(entity.getOrderNo(), entity.getMatnr(), entity.getBatch(), entity.getAnfme())) { |
| | | |
| | | return R.error("订单数据回滚失败"); |
| | | }else { |
| | | orderNos.add(entity.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (String orderNo : orderNos) { |
| | | orderService.BackToInit(orderNo); |
| | | } |
| | | return R.ok(); |
| | | } |