From 08c24a5530f6e5a9675a1cfcab22b24848adceec Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期二, 21 十月 2025 08:44:50 +0800
Subject: [PATCH] 联调
---
src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java | 139 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 138 insertions(+), 1 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 52f2dd5..b0c4610 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -1,19 +1,31 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
@Service("MatBarcodeService")
public class MatBarcodeServiceImpl extends ServiceImpl<MatBarcodeMapper, MatBarcode> implements MatBarcodeService {
@Autowired
private MatBarcodeMapper matBarcodeMapper;
+ @Autowired
+ private MatBarcodeService matBarcodeService;
+ @Autowired
+ private MatService matService;
+ @Autowired
+ private HalfBarcodeService halfBarcodeService;
@Override
public MatBarcode selectbyMatnr(String matnr) {
return this.baseMapper.selectByMatnr(matnr);
@@ -22,7 +34,132 @@
@Override
public void deleteMatBarcode(List<MatBarcode> list) {
for (MatBarcode matBarcode : list) {
+ HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
+ halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
+ halfBarcode.setPrice(halfBarcode.getPrice() + 1);
+ if (!halfBarcodeService.half(halfBarcode)){
+ throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+ }
matBarcodeMapper.deleteByMatnr(matBarcode.getMatnr());
}
}
+
+ @Override
+ public void addBarcodeMatnr(WaitPakin waitPakin) {
+ Mat mat = matService.selectById(waitPakin.getModiUser());
+ if (mat == null){
+ throw new CoolException("鐗╂枡涓嶅瓨鍦紝璇峰厛娣诲姞鐗╂枡鏁版嵁");
+ }
+ MatBarcode matBarcode = matBarcodeMapper.selectByMatnr(mat.getMatnr());
+ if (matBarcode != null){
+ throw new CoolException("璇ョ墿鏂欏凡缁忕粦瀹氭墭鐩橈紝璇峰嬁閲嶅缁戝畾");
+ }
+ if (mat.getColor().equals("鎶ュ簾")){
+ throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
+ }
+ HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
+ 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);
+ }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
+ hb.setPrice(24-1);
+ }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
+ hb.setPrice(24-1);
+ }
+ if (!halfBarcodeService.insert(hb)){
+ throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+ }
+ }else {
+ if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ }
+ if (!halfBarcodeService.half(halfBarcode)){
+ throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+ }
+ }
+ MatBarcode mb=new MatBarcode();
+ mb.setZpallet(waitPakin.getBarcode());
+ mb.setMatnr(mat.getMatnr());
+ mb.setMaktx(mat.getMaktx());
+ mb.setSpecs(mat.getSpecs());
+ mb.setModel(mat.getModel());
+ if (!matBarcodeService.insert(mb)){
+ throw new CoolException("鐗╂枡鎵樼洏缁戝畾澶辫触");
+ }
+ }
+
+ @Override
+ public void addBarcodeMatnrTwo(Mat mat) {
+ Mat m = matService.selectById(mat);
+ if (m == null){
+ throw new CoolException("鐗╂枡涓嶅瓨鍦紝璇峰厛娣诲姞鐗╂枡鏁版嵁");
+ }
+ MatBarcode matBarcode = matBarcodeMapper.selectByMatnr(mat.getMatnr());
+ if (matBarcode != null){
+ throw new CoolException("璇ョ墿鏂欏凡缁忕粦瀹氭墭鐩橈紝璇峰嬁閲嶅缁戝畾");
+ }
+ if (mat.getColor().equals("鎶ュ簾")){
+ throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
+ }
+ HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
+ 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(24-1);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+ hb.setPrice(24-1);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+ hb.setPrice(24-1);
+ }
+ 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()-1);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+ halfBarcode.setPrice(halfBarcode.getPrice()-1);
+ }
+ 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());
+ if (!matBarcodeService.insert(mb)){
+ throw new CoolException("鐗╂枡鎵樼洏缁戝畾澶辫触");
+ }
+ }
+
+ @Override
+ public String page(Map<String, Object> param) {
+ Integer pageNo = Integer.valueOf(param.get("curr").toString());
+ Integer pageSize = Integer.valueOf(param.get("limit").toString());
+ String barcode = (String) param.get("zpallet");
+ Integer spec = Integer.valueOf(param.get("spec").toString());
+ return matBarcodeMapper.page(pageNo,pageSize,barcode,spec);
+ }
}
--
Gitblit v1.9.1