|
|
@@ -11,6 +11,7 @@ import com.uas.eis.sdk.dto.*;
|
|
|
import com.uas.eis.sdk.resp.*;
|
|
|
import com.uas.eis.service.RequestSTKService;
|
|
|
import com.uas.eis.service.STKService;
|
|
|
+import com.uas.eis.utils.BaseUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -140,7 +141,8 @@ public class STKServiceImpl implements STKService {
|
|
|
|
|
|
List<BomCostDTO> bomCostDTOList = baseDao.query("select * from (select rownum rn,AA.* from ( " +
|
|
|
" select BS_LEVEL,BS_SONCODE,Product.PR_DETAIL,Product.PR_SPEC,bd_location,Product.PR_SMTPOINT,BS_BASEQTY,BS_CURRENCY, " +
|
|
|
- " BS_RATE,case when BS_CURRENCY='RMB' then round(BS_PURCPRICE,8) else round(BS_PURCPRICE*CR_RATE,8) end BS_PURCPRICE,round(BS_M,8) BS_M,Product.pr_brand " +
|
|
|
+ " BS_RATE,case when BS_CURRENCY='RMB' then round(BS_PURCPRICE,8) else round(BS_PURCPRICE*CR_RATE,8) end BS_PURCPRICE,round(BS_M,8) BS_M,Product.pr_brand," +
|
|
|
+ " (select pd_price from (select pd_price,pd_prodcode prodcode,row_number() over(partition by pd_prodcode order by pu_auditdate desc) row_number from purchasedetail left join purchase on pd_puid=pu_id where pu_statuscode in ('AUDITED','FINISH')) t where row_number=1 and prodcode=Product.pr_code) price " +
|
|
|
" from BOMStruct " +
|
|
|
" LEFT JOIN Currencys ON BOMStruct.BS_CURRENCY=Currencys.CR_NAME" +
|
|
|
" LEFT JOIN Vendor ON BOMStruct.BS_VENDNAME=Vendor.VE_NAME" +
|
|
|
@@ -220,6 +222,45 @@ public class STKServiceImpl implements STKService {
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result getBomAndSon(BomReq bomReq) {
|
|
|
+ String bomId = bomReq.getBomId();
|
|
|
+ Object bo_mothercode = null;
|
|
|
+ if (bomId == null || Integer.valueOf(bomId) == 0){
|
|
|
+ return Result.error("BOMID不存在!");
|
|
|
+ }else{
|
|
|
+ bo_mothercode = baseDao.getFieldDataByCondition("bom", "bo_mothercode", "bo_id=" + bomId);
|
|
|
+ }
|
|
|
+ if(bo_mothercode==null){
|
|
|
+ return Result.error("BOM母件编号不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bomId != null && !bomId.equals("") && bomId.matches("\\d*") && bo_mothercode != null && !bo_mothercode.equals("")) {
|
|
|
+ SqlRowList rs = baseDao
|
|
|
+ .queryForRowSet("select bo_id,pr_specdescription from product left join bom on (pr_code=bo_mothercode or pr_refno=bo_mothercode) where"
|
|
|
+ + " pr_code='" + bo_mothercode + "' and bo_id=" + bomId);
|
|
|
+ if (rs.next()) {
|
|
|
+ String res = baseDao.callProcedure("MM_SetProdBomStruct",
|
|
|
+ new Object[] { rs.getInt("bo_id"), rs.getString("pr_specdescription") });
|
|
|
+ if (res != null && res.length() > 0) {
|
|
|
+ BaseUtil.showError(res);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return Result.error("BOM母件编号不存在!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<BomStructDTO> bomStructDTOList = baseDao.query("select * from (select bs_idcode,bs_level,bs_bomid,bs_sonbomid,bs_mothercode,bs_bddetno,bs_soncode,pr_detail,pr_spec,pr_speccs,pr_unit,bs_baseqty,bs_location,bs_usestatus,bs_ecncode,bs_remark,bs_ifrep,ifrep,pr_lossrate,pr_leadtime,pr_zxdhl,po_onhand-nvl(po_defectonhand,0) po_onhand,PR_STANDARDIZED,pr_material,pr_sqrq,bo_level,bo_wccode,bo_ispast " +
|
|
|
+ " from MA_BOMSTRUCT_VIEW where bs_topbomid="+bomId+" AND (bs_topmothercode='"+bo_mothercode+"') " +
|
|
|
+ " order by bs_topbomid,bs_idcode,ifrep desc,bs_soncode )" , BomStructDTO.class);
|
|
|
+
|
|
|
+ if (bomStructDTOList.size() > 0 ){
|
|
|
+ return Result.success(bomStructDTOList);
|
|
|
+ }else{
|
|
|
+ return Result.error("BOM母件编号不存在!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* bom成本计算 打印前执行方法
|
|
|
* @param id
|