从接口实现销售价每个客户不同的价格

This commit is contained in:
季圣华
2023-06-11 18:47:07 +08:00
parent d59ace2149
commit 04f6fdfd40
4 changed files with 43 additions and 1 deletions

View File

@@ -457,6 +457,7 @@ public class MaterialController {
@GetMapping(value = "/getMaterialByBarCode") @GetMapping(value = "/getMaterialByBarCode")
@ApiOperation(value = "根据条码查询商品信息") @ApiOperation(value = "根据条码查询商品信息")
public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode, public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode,
@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "depotId", required = false) Long depotId, @RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("mpList") String mpList, @RequestParam("mpList") String mpList,
@RequestParam(required = false, value = "prefixNo") String prefixNo, @RequestParam(required = false, value = "prefixNo") String prefixNo,
@@ -483,7 +484,12 @@ public class MaterialController {
mvo.setBillPrice(mvo.getPurchaseDecimal()); mvo.setBillPrice(mvo.getPurchaseDecimal());
} else if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) { } else if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
//销售价 //销售价
mvo.setBillPrice(mvo.getWholesaleDecimal()); if(organId == null) {
mvo.setBillPrice(mvo.getWholesaleDecimal());
} else {
//查询最后一单的销售价,实现不同的客户不同的销售价
mvo.setBillPrice(depotItemService.getLastUnitPriceByParam(organId, mvo.getMeId(), prefixNo));
}
} }
//仓库id //仓库id
if (depotId == null) { if (depotId == null) {

View File

@@ -233,4 +233,10 @@ public interface DepotItemMapperEx {
BigDecimal getCurrentStockByParam( BigDecimal getCurrentStockByParam(
@Param("depotId") Long depotId, @Param("depotId") Long depotId,
@Param("mId") Long mId); @Param("mId") Long mId);
BigDecimal getLastUnitPriceByParam(
@Param("organId") Long organId,
@Param("meId") Long meId,
@Param("type") String type,
@Param("subType") String subType);
} }

View File

@@ -1195,4 +1195,23 @@ public class DepotItemService {
map.put("rows", arr); map.put("rows", arr);
return map; return map;
} }
public BigDecimal getLastUnitPriceByParam(Long organId, Long meId, String prefixNo) {
String type = "";
String subType = "";
if("XSDD".equals(prefixNo)) {
type = "其它";
subType = "销售订单";
} else if("XSCK".equals(prefixNo)) {
type = "出库";
subType = "销售";
} else if("XSTH".equals(prefixNo)) {
type = "入库";
subType = "销售退货";
} else if("QTCK".equals(prefixNo)) {
type = "出库";
subType = "其它";
}
return depotItemMapperEx.getLastUnitPriceByParam(organId, meId, type, subType);
}
} }

View File

@@ -989,4 +989,15 @@
</if> </if>
and ifnull(delete_flag,'0') !='1' and ifnull(delete_flag,'0') !='1'
</select> </select>
<select id="getLastUnitPriceByParam" resultType="java.math.BigDecimal">
select di.unit_price from jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where dh.organ_id = #{organId}
and di.material_extend_id = #{meId}
and dh.type = #{type} and dh.sub_type = #{subType}
and ifnull(dh.delete_flag,'0') !='1'
order by dh.id desc, di.id desc
limit 0,1
</select>
</mapper> </mapper>