Commit 2a39d370 by zhanglt

领用模块获取操作人,

盘盈入库生成单个二维码
parent b991e8ce
...@@ -14,6 +14,7 @@ import javax.validation.ConstraintViolationException; ...@@ -14,6 +14,7 @@ import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.sys.entity.User; import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.service.SystemService; import com.jeeplus.modules.sys.service.SystemService;
import com.jeeplus.modules.sys.utils.UserUtils;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -96,6 +97,9 @@ public class MaterialRequisitionController extends BaseController { ...@@ -96,6 +97,9 @@ public class MaterialRequisitionController extends BaseController {
if(materialRequisition.getNumber()==null|| Objects.equals(materialRequisition.getNumber(), "")){ if(materialRequisition.getNumber()==null|| Objects.equals(materialRequisition.getNumber(), "")){
materialRequisition.setNumber(materialRequisitionService.createLYDH()); materialRequisition.setNumber(materialRequisitionService.createLYDH());
} }
if(materialRequisition.getOperator() == null){
materialRequisition.setOperator(UserUtils.getUser());
}
model.addAttribute("materialRequisition", materialRequisition); model.addAttribute("materialRequisition", materialRequisition);
model.addAttribute("mode", mode); model.addAttribute("mode", mode);
return "modules/warehouse/materialrequisition/materialRequisitionForm"; return "modules/warehouse/materialrequisition/materialRequisitionForm";
......
...@@ -3,14 +3,22 @@ ...@@ -3,14 +3,22 @@
*/ */
package com.jeeplus.modules.warehouse.profitwarehousing.service; package com.jeeplus.modules.warehouse.profitwarehousing.service;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.jeeplus.common.config.Global;
import com.jeeplus.modules.warehouse.code.util.CodeUtil; import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq; import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo;
import com.jeeplus.modules.warehouse.ledger.entity.Ledger; import com.jeeplus.modules.warehouse.ledger.entity.Ledger;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo; import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper; import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper;
import com.jeeplus.modules.warehouse.qrcode.util.BuildQcUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -36,6 +44,8 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -36,6 +44,8 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
private ProfitWarehousingInfoMapper profitWarehousingInfoMapper; private ProfitWarehousingInfoMapper profitWarehousingInfoMapper;
@Autowired @Autowired
private LedgerMapper ledgerMapper; private LedgerMapper ledgerMapper;
@Autowired
private QrCodeMapper qrCodeMapper;
public ProfitWarehousing get(String id) { public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id); ProfitWarehousing profitWarehousing = super.get(id);
...@@ -55,6 +65,36 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -55,6 +65,36 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
String pydh = CodeUtil.code("PYDH", StaticNumSeq.PYDH); String pydh = CodeUtil.code("PYDH", StaticNumSeq.PYDH);
return pydh; return pydh;
} }
/**
* 生成单个,盘盈入库二维码
*/
@Transactional(readOnly = false)
public ProfitWarehousingInfo printQr(String infoId) {
String qrImgPath = Global.getAttachmentDir() + "image";
File file = new File(qrImgPath);
if (!file .exists() && !file .isDirectory()) {
System.out.println("//不存在");
file .mkdirs();
}
ProfitWarehousingInfo profitWarehousingInfo = profitWarehousingInfoMapper.get(infoId);
String numSeq = CodeUtil.code("WZBM", StaticNumSeq.WZBM);
QrCode qrCode = new QrCode();
qrCode.setCode(numSeq);
qrCode.setState("0");
qrCode.preInsert();
try {
BuildQcUtil.buildQr(qrCode, qrImgPath + "/" + numSeq + ".png", qrImgPath + "/" + numSeq + ".png"); // 生成图片
} catch (IOException e) {
e.printStackTrace();
}
qrCode.setUrl(Global.getAttachmentUrl() + "image/" + numSeq + ".png");
qrCodeMapper.insert(qrCode);
qrCode = qrCodeMapper.get(qrCode.getId());
profitWarehousingInfo.setQrCode(qrCode);
profitWarehousingInfoMapper.insert(profitWarehousingInfo);
return profitWarehousingInfo;
}
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void save(ProfitWarehousing profitWarehousing) { public void save(ProfitWarehousing profitWarehousing) {
profitWarehousing.setNumber(createPYDH()); profitWarehousing.setNumber(createPYDH());
...@@ -100,10 +140,20 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -100,10 +140,20 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
//获取同名称类型型号的台账主表信息 //获取同名称类型型号的台账主表信息
Ledger ledger = new Ledger(one.getName(),one.getType(),one.getMarking()); Ledger ledger = new Ledger(one.getName(),one.getType(),one.getMarking());
Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger); Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger);
if(oldLeger!=null){
LedgerInfo ledgerInfo = new LedgerInfo(); LedgerInfo ledgerInfo = new LedgerInfo();
ledgerInfo.setLedger(oldLeger); //单价
ledgerInfo.setAmount(one.getAmount()); ledgerInfo.setAmount(one.getAmount());
//名称
ledgerInfo.setName(one.getName());
//盘盈入库单号
ledgerInfo.setBatchNum(profitWarehousing.getNumber());
//物资编码
ledgerInfo.setCode("");
if(oldLeger!=null){
//台账主表
ledgerInfo.setLedger(oldLeger);
}else {
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment