| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.PltBarcode; |
| | | import com.zy.asrs.service.PltBarcodeService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.PltBarcode; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.PltBarcodeService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.ints.entity.WaitMatin; |
| | | import com.zy.ints.service.WaitMatinService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class PltBarcodeController extends BaseController { |
| | | |
| | | @Autowired |
| | | private PltBarcodeService pltBarcodeService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private WaitMatinService waitMatinService; |
| | | |
| | | @RequestMapping(value = "/pltBarcode/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<PltBarcode> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(PltBarcode.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(pltBarcodeService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/pltBarcode/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | pltBarcodeService.deleteById(id); |
| | | public R delete(@RequestParam(value="ids[]") String[] ids){ |
| | | for (String id : ids){ |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",id)); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",id)); |
| | | if (countLoc > 0 || countWrk > 0) { |
| | | return R.error("工作档或库存条码数据已存在"); |
| | | }else { |
| | | // List<WaitMatin> waitMatins = waitMatinService.selectList(); |
| | | List<PltBarcode> pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", id)); |
| | | for(PltBarcode pltBarcode : pltBarcodes){ |
| | | WaitMatin waitMatin = waitMatinService.selectOne(new EntityWrapper<WaitMatin>().eq("bill_no",pltBarcode.getBillNo()) |
| | | .eq("seq_no",pltBarcode.getSeqNo()).eq("mat_no",pltBarcode.getMatNo())); |
| | | if(null != waitMatin){ |
| | | waitMatin.setInQty(waitMatin.getInQty()-pltBarcode.getQty()); |
| | | waitMatinService.update(waitMatin,new EntityWrapper<WaitMatin>().eq("bill_no",pltBarcode.getBillNo()) |
| | | .eq("seq_no",pltBarcode.getSeqNo()).eq("mat_no",pltBarcode.getMatNo())); |
| | | } |
| | | } |
| | | pltBarcodeService.delete(new EntityWrapper<PltBarcode>().eq("barcode", id)); |
| | | } |
| | | // pltBarcodeService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |