| | |
| | | package com.example.erp.service.mm; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.example.erp.entity.mm.FinishedGoodsInventory; |
| | | import com.example.erp.entity.mm.FinishedOperateLog; |
| | | import com.example.erp.entity.pp.FlowCard; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper; |
| | | import com.example.erp.mapper.mm.FinishedOperateLogMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.time.LocalDate; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | public class FinishedGoodsInventoryService { |
| | | @Autowired |
| | | FinishedGoodsInventoryMapper finishedGoodsInventoryMapper; |
| | | @Autowired |
| | | FinishedOperateLogMapper finishedOperateLogMapper; |
| | | public Map<String,Object> defaultDateFinishedGoodsInventory(Integer pageNum, Integer pageSize,FinishedGoodsInventory finishedGoodsInventory) { |
| | | Integer offset = (pageNum-1)*pageSize; |
| | | Map<String,Object> map = new HashMap<>(); |
| | |
| | | map.put("total",finishedGoodsInventoryMapper.getPageTotal(offset,pageSize,finishedGoodsInventory)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String,Object> getseletwarehousing(Integer pageNum, Integer pageSize, FlowCard flowCard) { |
| | | Integer offset = (pageNum-1)*pageSize; |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("data",finishedGoodsInventoryMapper.getseletwarehousing(offset,pageSize,flowCard)); |
| | | map.put("total",finishedGoodsInventoryMapper.getseletwarehousingPageTotal(offset,pageSize,flowCard)); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public Boolean addseletwarehousing(Map<String,Map<String,Object>> object) { |
| | | |
| | | Map<String,Object> maps= object.get("finishedGoodsInventory"); |
| | | String storageRegion= maps.get("storageRegion").toString(); |
| | | String remark= maps.get("remark").toString(); |
| | | JSONObject jsonObject = new JSONObject(object.get("flowcard")); |
| | | FlowCard flowCard = JSONObject.parseObject(JSONObject.toJSONString(jsonObject), FlowCard.class); |
| | | System.out.println("数据2:"+flowCard); |
| | | //添加出入库记录 |
| | | finishedOperateLogMapper.insertFinishedOperateLog(flowCard); |
| | | System.out.println(flowCard.getOrder().getOrderId()); |
| | | Integer finishedGoodsInventorycount=finishedGoodsInventoryMapper.findOrderNumberdcount(flowCard.getOrderNumber()); |
| | | System.out.println("数量:"+finishedGoodsInventorycount); |
| | | if(finishedGoodsInventorycount>0){ |
| | | finishedGoodsInventoryMapper.updateInventory(flowCard); |
| | | finishedGoodsInventoryMapper.updateflowcard(flowCard); |
| | | return true; |
| | | }else{ |
| | | if (finishedGoodsInventoryMapper.insertFinishedGoodsInventory(flowCard,storageRegion,remark)){ |
| | | finishedGoodsInventoryMapper.updateflowcard(flowCard); |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /*Order order=finishedGoodsInventoryMapper.findOrderId(flowCard.getOrder().getOrderId()); |
| | | OrderDetail orderDetail=finishedGoodsInventoryMapper.findOrderNumber(flowCard.getOrderNumber());*/ |
| | | /*finishedGoodsInventory.setOrder(order); |
| | | finishedGoodsInventory.setOrderDetail(orderDetail); |
| | | finishedGoodsInventory.setInventory(flowCard.getInventoryQuantity()); |
| | | finishedGoodsInventory.setActualSignalArea(flowCard.getOrderDetail().getHeight()*flowCard.getOrderDetail().getWidth()); |
| | | finishedGoodsInventory.setArea(flowCard.getOrderDetail().getHeight()*flowCard.getOrderDetail().getWidth()*flowCard.getInventoryQuantity()); |
| | | finishedGoodsInventory.setQuantityAvailable(flowCard.getInventoryQuantity()); |
| | | finishedGoodsInventory.setWarehouseNumber(flowCard.getOrderDetail().getBuildingNumber()); |
| | | finishedGoodsInventory.setStorageRegion(flowCard.getOrderDetail().getBuildingNumber()); |
| | | finishedGoodsInventory.setStatus(0); |
| | | finishedGoodsInventory.setEnterStorageTime(LocalDate.now()); |
| | | finishedGoodsInventory.setUpdateTime(LocalDate.now()); |
| | | finishedGoodsInventory.setEndTime(null); |
| | | finishedGoodsInventory.setRemark("");*/ |
| | | |
| | | |
| | | |
| | | } |
| | | } |