Commit 437f11c7 by 胡懿

Merge branches 'hy' and 'master' of gitlab.yqdchina.com:huyi/warehouse into hy

parents 3904b920 b991e8ce
......@@ -5,6 +5,7 @@ package com.jeeplus.modules.sys.web;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -548,7 +549,22 @@ public class UserController extends BaseController {
}
return mapList;
}
/**
* 获取 领用机构下的 所有用户
*/
@ResponseBody
@RequestMapping(value = "getUserListByOfficeId")
public List<User> getUserListByOfficeId(String officeId) throws Exception{
/**
* 后台hibernate-validation插件校验
*/
List<User> list = new ArrayList<>();
if (StringUtils.isBlank(officeId)){
return list;
}
list = systemService.findUserByOfficeId(officeId);
return list;
}
/**
* web端ajax验证用户名是否可用
* @param loginName
......
......@@ -41,6 +41,12 @@ public class Ledger extends DataEntity<Ledger> {
super(id);
}
public Ledger(String name, MaterialType type, String model) {
this.name = name;
this.type = type;
this.model = model;
}
@NotNull(message="物资名称不能为空")
@ExcelField(title="物资名称", align=2, sort=1)
public String getName() {
......
......@@ -6,6 +6,7 @@ package com.jeeplus.modules.warehouse.materialrequisition.web;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -92,6 +93,9 @@ public class MaterialRequisitionController extends BaseController {
@RequiresPermissions(value={"warehouse:materialrequisition:materialRequisition:view","warehouse:materialrequisition:materialRequisition:add","warehouse:materialrequisition:materialRequisition:edit"},logical=Logical.OR)
@RequestMapping(value = "form/{mode}")
public String form(@PathVariable String mode, MaterialRequisition materialRequisition, Model model) {
if(materialRequisition.getNumber()==null|| Objects.equals(materialRequisition.getNumber(), "")){
materialRequisition.setNumber(materialRequisitionService.createLYDH());
}
model.addAttribute("materialRequisition", materialRequisition);
model.addAttribute("mode", mode);
return "modules/warehouse/materialrequisition/materialRequisitionForm";
......
......@@ -3,10 +3,14 @@
*/
package com.jeeplus.modules.warehouse.profitwarehousing.service;
import java.math.BigDecimal;
import java.util.List;
import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.ledger.entity.Ledger;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -30,7 +34,9 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
@Autowired
private ProfitWarehousingInfoMapper profitWarehousingInfoMapper;
@Autowired
private LedgerMapper ledgerMapper;
public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id);
profitWarehousing.setProfitWarehousingInfoList(profitWarehousingInfoMapper.findList(new ProfitWarehousingInfo(profitWarehousing)));
......@@ -77,5 +83,30 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
super.delete(profitWarehousing);
profitWarehousingInfoMapper.delete(new ProfitWarehousingInfo(profitWarehousing));
}
//盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息
@Transactional(readOnly = false)
public void inLedgerInfo(ProfitWarehousing profitWarehousing) {
List<ProfitWarehousingInfo> profitWarehousingInfoList = profitWarehousing.getProfitWarehousingInfoList();
//当前盘盈入库单的明细信息
BigDecimal sum = BigDecimal.ONE;
if(profitWarehousingInfoList != null ){
if(profitWarehousingInfoList.size() > 0 ){
for (ProfitWarehousingInfo one:profitWarehousingInfoList) {
BigDecimal amount = one.getAmount();
if(amount != null){
//总价 是所有单价之和
sum = sum.add(amount);
}
//获取同名称类型型号的台账主表信息
Ledger ledger = new Ledger(one.getName(),one.getType(),one.getMarking());
Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger);
if(oldLeger!=null){
LedgerInfo ledgerInfo = new LedgerInfo();
ledgerInfo.setLedger(oldLeger);
ledgerInfo.setAmount(one.getAmount());
}
}
}
}
}
}
\ No newline at end of file
......@@ -228,6 +228,28 @@ public class ProfitWarehousingController extends BaseController {
}
return j;
}
/**
* 保存新增盘盈入库信息后,入台账
*/
@ResponseBody
@RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR)
@RequestMapping(value = "inLedgerInfo")
public AjaxJson inLedgerInfo(ProfitWarehousing profitWarehousing, Model model) throws Exception{
AjaxJson j = new AjaxJson();
/**
* 后台hibernate-validation插件校验
*/
String errMsg = beanValidator(profitWarehousing);
if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
//新增或编辑表单保存
profitWarehousingService.inLedgerInfo(profitWarehousing);//保存
j.setSuccess(true);
j.setMsg("物资入帐成功");
return j;
}
}
\ No newline at end of file
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