修复采购入库列表库存的bug

This commit is contained in:
季圣华 2020-12-25 23:08:27 +08:00
parent d0f56f8413
commit 91a10eec82
4 changed files with 21 additions and 19 deletions

View File

@ -645,7 +645,7 @@
}
function findStockList(mId, barCode, name) {
var titleInfo = " " + name + "[" + barCode + "]库存及明细";
var titleInfo = " " + name + "[" + barCode + "]库存及明细";
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/>' + titleInfo);
$(".window-mask").css({width: webW, height: webH});
initDepotList(mId, "show"); //加载仓库及库存数量

View File

@ -127,7 +127,6 @@ public class DepotItemController {
@RequestParam("mpList") String mpList,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
Long tenantId = null;
if(request.getSession().getAttribute("tenantId")!=null) {
tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
@ -147,29 +146,21 @@ public class DepotItemController {
JSONObject item = new JSONObject();
item.put("Id", diEx.getId());
item.put("MaterialExtendId", diEx.getMaterialExtendId() == null ? "" : diEx.getMaterialExtendId());
String ratio; //比例
if (diEx.getUnitId() == null || diEx.getUnitId().equals("")) {
ratio = "";
} else {
ratio = diEx.getUnitName();
ratio = ratio.substring(ratio.indexOf("("));
}
//名称/型号/扩展信息/包装
String MaterialName = ((diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName())
+ ((diEx.getMStandard() == null || diEx.getMStandard().equals("")) ? "" : "(" + diEx.getMStandard() + ")")
+ ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
String materialOther = getOtherInfo(mpArr, diEx);
MaterialName = MaterialName + materialOther + ((diEx.getUnitName() == null || diEx.getUnitName().equals("")) ? "" : "(" + diEx.getUnitName() + ")") + ratio;
item.put("MaterialName", MaterialName == null ? "" : MaterialName);
item.put("barCode", diEx.getBarCode());
item.put("name", diEx.getMName());
item.put("standard", diEx.getMStandard());
item.put("model", diEx.getMModel());
item.put("materialOther", materialOther);
item.put("materialOther", getOtherInfo(mpArr, diEx));
Integer ratio = diEx.getRatio();
BigDecimal stock = depotItemService.getStockByParam(diEx.getDepotId(),diEx.getMaterialId(),null,null,tenantId);
if(ratio!=null){
BigDecimal ratioDecimal = new BigDecimal(ratio.toString());
if(ratioDecimal.compareTo(BigDecimal.ZERO)!=0){
stock = stock.divide(ratioDecimal,2,BigDecimal.ROUND_HALF_UP); //两位小数
}
}
item.put("Stock", stock);
item.put("Unit", diEx.getMaterialUnit());
item.put("currentStock", diEx.getOperNumber().add(stock));
item.put("OperNumber", diEx.getOperNumber());
item.put("BasicNumber", diEx.getBasicNumber());
item.put("UnitPrice", diEx.getUnitPrice());

View File

@ -32,6 +32,8 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
private String unitName;
private Integer ratio;
private BigDecimal presetPriceOne;
private String priceStrategy;
@ -152,6 +154,14 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
this.unitName = unitName;
}
public Integer getRatio() {
return ratio;
}
public void setRatio(Integer ratio) {
this.ratio = ratio;
}
public BigDecimal getPresetPriceOne() {
return presetPriceOne;
}

View File

@ -29,6 +29,7 @@
<result column="AnotherDepotName" jdbcType="VARCHAR" property="AnotherDepotName" />
<result column="UnitId" jdbcType="BIGINT" property="UnitId" />
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
<result column="ratio" jdbcType="INTEGER" property="ratio" />
<result column="barCode" jdbcType="VARCHAR" property="barCode" />
</resultMap>
@ -140,7 +141,7 @@
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select di.*,m.name MName,m.model MModel,m.unit MaterialUnit,m.color MColor,m.standard MStandard,m.mfrs MMfrs,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.name unit_name, me.bar_code barCode
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.name unit_name, u.ratio, me.bar_code barCode
from jsh_depot_item di
left join jsh_material m on di.material_id=m.id and ifnull(m.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'