| | |
| | | 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.entity.userInfo.SysError; |
| | | import com.example.erp.mapper.mm.BasicWarehouseTypeMapper; |
| | | import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper; |
| | | import com.example.erp.mapper.mm.FinishedOperateLogMapper; |
| | | import com.example.erp.service.userInfo.SysErrorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | |
| | | @Service |
| | | @DS("mm") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class FinishedGoodsInventoryService { |
| | | @Autowired |
| | | FinishedGoodsInventoryMapper finishedGoodsInventoryMapper; |
| | |
| | | FinishedOperateLogMapper finishedOperateLogMapper; |
| | | @Autowired |
| | | BasicWarehouseTypeMapper basicWarehouseTypeMapper; |
| | | @Autowired |
| | | SysErrorService sysErrorService; |
| | | |
| | | public Map<String, Object> defaultDateFinishedGoodsInventory(Integer pageNum, Integer pageSize, FinishedGoodsInventory finishedGoodsInventory) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | |
| | | |
| | | |
| | | public Boolean adddeliveryDetail(Map<String,Object> object) { |
| | | Boolean isinsert=false; |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String userName = ""; |
| | | String userId = ""; |
| | | if (object.get("userName") != null) { |
| | |
| | | //修改发货表状态 |
| | | finishedGoodsInventoryMapper.updateDeliveryDeliveryState(orderDetail.getDeliveryDetail().getDeliveryId(),2); |
| | | } |
| | | isinsert=true; |
| | | } |
| | | |
| | | } else { |
| | | isinsert=false; |
| | | } |
| | | } |
| | | return isinsert; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public Boolean updateFinishedGoodsInventoryAllocate(Map<String,Object> object) { |
| | | Boolean isinsert=false; |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String userName = ""; |
| | | String userId = ""; |
| | | if (object.get("userName") != null) { |
| | |
| | | //修改订单表入库状态 |
| | | finishedGoodsInventoryMapper.updateOrderWarehousingState(orderDetail.getFinishedGoodsInventory().getOrderId(),1); |
| | | } |
| | | isinsert=true; |
| | | } |
| | | return isinsert; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | public Boolean updateFinishedGoodsInventoryTakeOut(Map<String,Object> object) { |
| | | Boolean isinsert=false; |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String userName = ""; |
| | | String userId = ""; |
| | | if (object.get("userName") != null) { |
| | |
| | | //修改订单表入库状态 |
| | | finishedGoodsInventoryMapper.updateOrderWarehousingState(orderDetail.getFinishedGoodsInventory().getOrderId(),1); |
| | | } |
| | | isinsert=true; |
| | | } |
| | | return isinsert; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | /* public Map<String, Object> getselectTakeOutFinishedOperateLog(Integer pageNum, Integer pageSize, FinishedOperateLog finishedOperateLog) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", finishedOperateLogMapper.getselectAllocateFinishedOperateLog(offset, pageSize, finishedOperateLog)); |
| | | map.put("total", finishedOperateLogMapper.getselectAllocateFinishedOperateLogPageTotal(offset, pageSize, finishedOperateLog)); |
| | | return map; |
| | | }*/ |
| | | |
| | | public Map<String, Object> getSelectOperateRecord(Integer pageNum, Integer pageSize, List<String> selectDate, FinishedOperateLog finishedOperateLog) { |
| | | Integer offset = (pageNum-1)*pageSize; |
| | |
| | | |
| | | |
| | | public Boolean updateFinishedGoodsInventoryRework(Map<String,Object> object) { |
| | | Boolean isinsert=false; |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String userName = ""; |
| | | String userId = ""; |
| | | if (object.get("userName") != null) { |
| | |
| | | //修改订单表入库状态 |
| | | finishedGoodsInventoryMapper.updateOrderWarehousingState(orderDetail.getFinishedGoodsInventory().getOrderId(),1); |
| | | } |
| | | isinsert=true; |
| | | } |
| | | return isinsert; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | |
| | | public Boolean updateFinishedGoodsInventoryToExamine(Map<String,Object> object,String type) { |
| | | Boolean isinsert=false; |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String userName = ""; |
| | | String userId = ""; |
| | | if (object.get("userName") != null) { |
| | |
| | | finishedGoodsInventoryMapper.updateInventoryInventoryInt(finishedOperateLog.getOrderId(),finishedOperateLog.getOperationNumber(),Math.toIntExact(finishedOperateLog.getQuantity())); |
| | | } |
| | | |
| | | |
| | | isinsert=true; |
| | | } |
| | | return isinsert; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |