From db9a7f9c1b61af84be764a399b3f1f85e0ff03ee Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 27 十一月 2025 09:37:36 +0800
Subject: [PATCH] #1
---
src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java | 85 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
index 721ccff..b9dad76 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -1,17 +1,17 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.HalfBarcode;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.MatBarcode;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.mapper.MatBarcodeMapper;
-import com.zy.asrs.service.HalfBarcodeService;
-import com.zy.asrs.service.MatBarcodeService;
-import com.zy.asrs.service.MatService;
+import com.zy.asrs.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -26,17 +26,37 @@
private MatService matService;
@Autowired
private HalfBarcodeService halfBarcodeService;
+ @Autowired
+ private WaitPakinService waitPakinService;
+ @Autowired
+ private WrkDetlService wrkDetlService;
+ @Autowired
+ private LocDetlService locDetlService;
@Override
public MatBarcode selectbyMatnr(String matnr) {
return this.baseMapper.selectByMatnr(matnr);
}
+ @Transactional
@Override
public void deleteMatBarcode(List<MatBarcode> list) {
for (MatBarcode matBarcode : list) {
+ //瀵逛簬宸茬粡鏈夊簱瀛� 缁勬墭妗� 宸ヤ綔妗g殑鏁版嵁 涓嶅厑璁歌В缁�
+ Integer locCount = locDetlService.selectCountByMatNr(matBarcode.getMatnr());
+ Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
+ Integer wrkCount = wrkDetlService.selectCountByMatNr(matBarcode.getMatnr());
+ if (locCount > 0 || waitCount > 0 || wrkCount > 0){
+ throw new CoolException("缁勬墭妗�/搴撳瓨/宸ヤ綔妗e瓨鍦ㄨ妯″叿,涓嶈兘瑙g粦,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr() + "鎵樼洏鐮�:" + matBarcode.getZpallet());
+ }
+ //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+ Integer thickness = 0;
+ if (!Cools.isEmpty(matBarcode.getSpecs())){
+ String[] split = matBarcode.getSpecs().split("\\*");
+ thickness = Integer.parseInt(split[1]);
+ }
HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
- halfBarcode.setPrice(halfBarcode.getPrice() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
if (!halfBarcodeService.half(halfBarcode)){
throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
}
@@ -58,17 +78,23 @@
throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
}
HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
+ //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+ Integer thickness = 0;
+ if (!Cools.isEmpty(mat.getSpecs())){
+ String[] split = mat.getSpecs().split("\\*");
+ thickness = Integer.parseInt(split[1]);
+ }
if (halfBarcode == null){
HalfBarcode hb = new HalfBarcode();
hb.setZpallet(waitPakin.getBarcode());
hb.setSpecs(waitPakin.getBarcode().substring(0,1));
hb.setAnfme(1);
if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
- hb.setPrice(24-1);
+ hb.setPrice(2650 - thickness);
}else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
- hb.setPrice(24-1);
+ hb.setPrice(1750 - thickness);
}else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
- hb.setPrice(24-1);
+ hb.setPrice(800 - thickness);
}
if (!halfBarcodeService.insert(hb)){
throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
@@ -76,13 +102,13 @@
}else {
if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
- halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ halfBarcode.setPrice(2650 - thickness);
}else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
- halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ halfBarcode.setPrice(1750 - thickness);
}else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
- halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ halfBarcode.setPrice(800 - thickness);
}
if (!halfBarcodeService.half(halfBarcode)){
throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
@@ -112,12 +138,49 @@
if (mat.getColor().equals("鎶ュ簾")){
throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
}
+ HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
+ //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+ Integer thickness = 0;
+ if (!Cools.isEmpty(mat.getSpecs())){
+ String[] split = mat.getSpecs().split("\\*");
+ thickness = Integer.parseInt(split[1]);
+ }
+ if (halfBarcode == null){
+ HalfBarcode hb = new HalfBarcode();
+ hb.setZpallet(mat.getUnit());
+ hb.setSpecs(mat.getUnit().substring(0,1));
+ hb.setAnfme(1);
+ if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
+ hb.setPrice(2650 - thickness);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+ hb.setPrice(1750 - thickness);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+ hb.setPrice(800 - thickness);
+ }
+ if (!halfBarcodeService.insert(hb)){
+ throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+ }
+ }else {
+ if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+ }
+ if (!halfBarcodeService.half(halfBarcode)){
+ throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+ }
+ }
MatBarcode mb=new MatBarcode();
mb.setZpallet(mat.getUnit());
mb.setMatnr(mat.getMatnr());
mb.setMaktx(mat.getMaktx());
mb.setSpecs(mat.getSpecs());
- mb.setModel(mat.getModel());
+ mb.setModel(mat.getName());
if (!matBarcodeService.insert(mb)){
throw new CoolException("鐗╂枡鎵樼洏缁戝畾澶辫触");
}
--
Gitblit v1.9.1