| | |
| | | /// </summary> |
| | | [Description("颿åºåº")] |
| | | Outbound = 100, |
| | | |
| | | /// <summary> |
| | | /// çç¹åºåº |
| | | /// </summary> |
| | | [Description("çç¹åºåº")] |
| | | OutInventory = 110, |
| | | |
| | | /// <summary> |
| | | /// 忣åºåº |
| | | /// </summary> |
| | | [Description("忣åºåº")] |
| | | OutPick = 120, |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£åºåº |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | |
| | | /// <summary> |
| | | /// æåæ¥åºåºåº |
| | | /// </summary> |
| | | [Description("æåæ¥åºåºåº")] |
| | | OutProScrap = 235, |
| | | /// <summary> |
| | | /// æåå¯å®åºåº |
| | | /// </summary> |
| | | [Description("æåå¯å®åºåº")] |
| | | OutSendProduct = 240, |
| | | |
| | | /// <summary> |
| | | /// æåMESæåº |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("é²çåæ´¾å·¥å¤§ä»¶")] |
| | | MaskOutNoticeLarge = 265, |
| | | |
| | | /// <summary> |
| | | /// é²çå°çº¿è¾¹å°ä»¶ |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å¤§ä»¶")] |
| | | MaskOutLarge = 275, |
| | | |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | | Inbound = 510, |
| | | |
| | | /// <summary> |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 520, |
| | | |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 530, |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£å
¥åº |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("å··éå
ç§»åº")] |
| | | Relocation = 900 |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/MesOutOrderDetail.vue' |
| | | import gridHeader from './extend/addMesOutOrder.vue' |
| | | import gridBody from './extend/ScrapSheet.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="dialogFormVisible" |
| | | :on-model-close="closeCustomModel" |
| | | :lazy="true" |
| | | width="20%" |
| | | :padding="15" |
| | | title="éæ©åºåºçº¿ä½" |
| | | > |
| | | <div> |
| | | <VolForm |
| | | ref="myform" |
| | | :label-width="120" |
| | | :loadKey="true" |
| | | :formFields="formFields2" |
| | | :formRules="formRules2" |
| | | > |
| | | |
| | | </VolForm> |
| | | </div> |
| | | <template #footer> |
| | | <!-- <el-button type="primary" size="small" @click="submit">确认</el-button> --> |
| | | <el-button type="danger" size="small" @click="outbound" |
| | | >åºåº</el-button |
| | | > |
| | | </template> |
| | | </vol-box> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | width="75%" |
| | | :padding="15" |
| | | title="æ¥åºæç»" |
| | | > |
| | | <div class="box-head"> |
| | | <el-alert :closable="false" style="width: 100%"> |
| | | <el-row> |
| | | <el-col :span="18"> |
| | | <span class="less-style">æ¥åºåå·ï¼ {{ row.proScrapSheetOrderNo }} </span> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <span>å·²éä¸ {{ selection.length }} 项</span> |
| | | <!-- <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px" |
| | | @click="lockstocks" |
| | | >éå®åºå</el-link |
| | | > --> |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | v-if="row.proScrapStatus == 0" |
| | | style="float: right; height: 20px; margin-right: 10px" |
| | | @click="UpProScrap" |
| | | >æäº¤æ¥åº</el-link |
| | | > |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px; margin-right: 10px" |
| | | @click="outSelect" |
| | | >ç´æ¥åºåº</el-link |
| | | > |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px; margin-right: 10px" |
| | | @click="getData" |
| | | >å·æ°</el-link |
| | | ></el-col> |
| | | </el-row> |
| | | |
| | | </el-alert> |
| | | </div> |
| | | <div class="box-table" style="margin-top: 1%"> |
| | | <el-table |
| | | ref="singleTable" |
| | | :data="tableData" |
| | | style="width: 100%; height: 100%" |
| | | highlight-current-row |
| | | @current-change="handleCurrentChange" |
| | | height="500px" |
| | | @row-click="handleRowClick" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | > |
| | | <el-table-column type="selection" width="55"> </el-table-column> |
| | | <el-table-column |
| | | label="åºå·" |
| | | type="index" |
| | | fixed="left" |
| | | width="55" |
| | | align="center" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | v-for="(item, index) in tableColumns.filter((x) => !x.hidden)" |
| | | :key="index" |
| | | :prop="item.prop" |
| | | :label="item.title" |
| | | :width="item.width" |
| | | align="center" |
| | | > |
| | | <template #default="scoped" v-if="item.type == 'icon'"> |
| | | <el-tooltip |
| | | class="item" |
| | | effect="dark" |
| | | :content="item.title" |
| | | placement="bottom" |
| | | ><el-button |
| | | type="text" |
| | | @click="tableButtonClick(scoped.row, item)" |
| | | ><i :class="item.icon" style="font-size: 22px"></i></el-button |
| | | ></el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <template #footer> |
| | | <!-- <el-button type="primary" size="small" @click="submit">确认</el-button> --> |
| | | <el-button type="danger" size="small" @click="showDetialBox = false" |
| | | >å
³é</el-button |
| | | > |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import VolForm from "@/components/basic/VolForm.vue"; |
| | | export default { |
| | | components: { VolBox,VolForm }, |
| | | data() { |
| | | return { |
| | | row: null, |
| | | showDetialBox: false, |
| | | flag: false, |
| | | currentRow: null, |
| | | selection: [], |
| | | tableData: [], |
| | | dialogFormVisible:false, |
| | | formLabelWidth: '160px', |
| | | formFields2: { |
| | | LineCode: "", |
| | | Grade: "0", |
| | | }, |
| | | formRules2:[[ |
| | | { |
| | | dataKey: "line", |
| | | title: "éæ©çº¿ä½", |
| | | required: true, |
| | | field: "LineCode", |
| | | data: [ |
| | | { key: "5236", value: "1å·çº¿" }, |
| | | { key: "5243", value: "2å·çº¿" }, |
| | | { key: "5250", value: "3å·çº¿" }, |
| | | ], |
| | | type: "select", |
| | | extra: { |
| | | |
| | | }, |
| | | }], |
| | | [ |
| | | { |
| | | title: "æ¯å¦ä¼å
", |
| | | field: "Grade", |
| | | data: [], |
| | | required: false, |
| | | type: "switch", |
| | | }, |
| | | ]], |
| | | form: { |
| | | name: '', |
| | | region: '', |
| | | date1: '', |
| | | date2: '', |
| | | delivery: false, |
| | | type: [], |
| | | resource: '', |
| | | desc: '', |
| | | }, |
| | | tableColumns: [ |
| | | { |
| | | prop: "id", |
| | | title: "主é®", |
| | | type: "string", |
| | | width: 150, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "proScrapSheetId", |
| | | title: "æåæ¥åºå主é®", |
| | | type: "string", |
| | | width: 150, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "scrapProCode", |
| | | title: "产åç¼ç ", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "scrapProVersion", |
| | | title: "æ¥åºçæ¬", |
| | | type: "string", |
| | | width: 120, |
| | | }, |
| | | { |
| | | prop: "scrapProLotNo", |
| | | title: "æ¹æ¬¡å·", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "scrapSETQty", |
| | | title: "æ¥åºSETæ°é", |
| | | type: "int", |
| | | width: 180, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "scrapPcsQty", |
| | | title: "æ¥åºPCSæ°", |
| | | type: "int", |
| | | width: 180, |
| | | }, |
| | | // { |
| | | // prop: "assignQuantity", |
| | | // title: "åé
åºåºé", |
| | | // type: "string", |
| | | // width: 100, |
| | | // }, |
| | | { |
| | | prop: "overScrapSETQty", |
| | | title: "å·²æ¥åºSETæ°", |
| | | type: "int", |
| | | width: 180, |
| | | }, |
| | | { |
| | | prop: "overScrapPcsQty", |
| | | title: "å·²æ¥åºPCSæ°", |
| | | type: "string", |
| | | width: 180, |
| | | }, |
| | | { |
| | | prop: "scrapProDetailStatus", |
| | | title: "订åæç»ç¶æ", |
| | | type: "string", |
| | | width: 180, |
| | | } |
| | | ], |
| | | }; |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.row = row; |
| | | console.log(row); |
| | | this.showDetialBox = true; |
| | | this.getData(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.currentRow = val; |
| | | }, |
| | | outSelect(){ |
| | | if (this.selection.length === 0) { |
| | | return this.$message.error("è¯·éæ©åæ®æç»"); |
| | | } |
| | | this.dialogFormVisible=true; |
| | | }, |
| | | handleRowClick(row) { |
| | | this.$refs.singleTable.toggleRowSelection(row); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.selection = val; |
| | | }, |
| | | UpProScrap() { |
| | | var keys = this.selection.map((item) => item.id); // è·åéä¸è¡çid |
| | | this.http |
| | | .post("api/ErpProScrapSheetDetail/UpProScrap?scrapNo="+ |
| | | this.row.proScrapSheetOrderNo, keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.$parent.refresh(); |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.getData(); |
| | | }); |
| | | }); |
| | | }, |
| | | closeCustomModel() { |
| | | this.formFields2.LineCode=""; |
| | | this.formFields2.Grade="0"; |
| | | this.dialogFormVisible=false; |
| | | this.$parent.refresh(); |
| | | }, |
| | | outbound() { |
| | | if (this.selection.length === 0) { |
| | | return this.$message.error("è¯·éæ©åæ®æç»"); |
| | | } |
| | | //è¯·éæ©åæ¡æ°æ® |
| | | if (this.selection.length > 1) { |
| | | return this.$message.error("è¯·éæ©åæ¡æ°æ®"); |
| | | } |
| | | var keys = this.selection.map((item) => item.id); // è·åéä¸è¡çid |
| | | |
| | | this.http |
| | | .post("api/Task/OutProductTask?stationCode="+this.formFields2.LineCode +"&grade="+this.formFields2.Grade, keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.formFields2.LineCode=""; |
| | | this.formFields2.Grade="0"; |
| | | this.dialogFormVisible=false; |
| | | this.$parent.refresh(); |
| | | this.showDetialBox = false; |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.getData(); |
| | | }); |
| | | }); |
| | | }, |
| | | getData() { |
| | | this.http |
| | | .post( |
| | | "api/ErpProScrapSheetDetail/GetByDetails?scrapNo=" + |
| | | this.row.proScrapSheetOrderNo, |
| | | null, |
| | | "æ¥è¯¢ä¸" |
| | | ) |
| | | .then((x) => { |
| | | var label=[ |
| | | { label: 'æªå¼å§', value: 0 }, |
| | | { label: 'åºåºä¸', value: 1 }, |
| | | { label: 'åºåºå®æ', value: 2 }, |
| | | { label: 'åæ¶', value: 98 }, |
| | | { label: 'æäº¤å
³é', value: 99 } |
| | | ] |
| | | this.tableData=x.map((i) => ({ |
| | | ...i, |
| | | scrapProDetailStatus:label.find((j) => j.value === i.scrapProDetailStatus).label |
| | | })) |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .less-style { |
| | | color: black; |
| | | } |
| | | .equle-style { |
| | | color: green; |
| | | } |
| | | .more-style { |
| | | color: red; |
| | | } |
| | | </style> |
| | | |
| | | <style> |
| | | .text-button:hover { |
| | | background-color: #f0f9eb !important; |
| | | } |
| | | .el-table .warning-row { |
| | | background: oldlace; |
| | | } |
| | | .box-table .el-table tbody tr:hover > td { |
| | | background-color: #d8e0d4 !important; |
| | | /* color: #ffffff; */ |
| | | } |
| | | |
| | | .box-table .el-table tbody tr.current-row > td { |
| | | background-color: #f0f9eb !important; |
| | | /* color: #ffffff; */ |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .box-table .el-table { |
| | | border: 1px solid #ebeef5; |
| | | } |
| | | .box-head .el-alert__content { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | table: "erpProScrapSheetDetail", |
| | | columns: [ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "proScrapSheetId", |
| | |
| | | } |
| | | _purchaseOrderDetailRepository.UpdateData(purchaseOrderDetail); |
| | | } |
| | | //ERP䏿¥ |
| | | WebResponseContent responseContent = _checkOrderService.FeedbackCheckResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); |
| | | if (!responseContent.Status) |
| | | if (string.IsNullOrEmpty(checkModel.CreatorCode)) |
| | | { |
| | | throw new Exception(responseContent.Message); |
| | | } |
| | | //ERP䏿¥ |
| | | WebResponseContent responseContent = _checkOrderService.FeedbackCheckResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); |
| | | if (!responseContent.Status) |
| | | { |
| | | throw new Exception(responseContent.Message); |
| | | } |
| | | } |
| | | checkOrder.UploadStatus = CheckUploadEnum.UploadOk.ObjToInt(); |
| | | _checkOrderRepository.UpdateData(checkOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | /// <summary> |
| | | /// æåæ¥åºåºåº |
| | | /// </summary> |
| | | [Description("æåæ¥åºåºåº")] |
| | | OutProScrap = 235, |
| | | /// <summary> |
| | | /// æåå¯å®åºåº |
| | | /// </summary> |
| | | [Description("æåå¯å®åºåº")] |
| | |
| | | /// </summary> |
| | | [Description("æåMESæåº")] |
| | | OutMesRworkProduct =250, |
| | | |
| | | |
| | | /// <summary> |
| | | /// é²çåæ´¾å·¥å°ä»¶ |
| | | /// </summary> |
| | |
| | | IProOutOrderRepository ProOutOrderRepository { get; } |
| | | IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } |
| | | IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } |
| | | IErpProScrapSheetRepository ErpProScrapSheetRepository { get;} |
| | | IErpProScrapSheetDetailRepository ErpProScrapDetailRepository { get;} |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public interface IErpProScrapSheetDetailService : IService<Dt_ErpProScrapSheetDetail> |
| | | { |
| | | IErpProScrapSheetDetailRepository Repository { get; } |
| | | List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo); |
| | | WebResponseContent UpProScrap(string scrapNo,int[] keys); |
| | | (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ErpProScrapSheetDetail> proOutOrderDetails, Dt_ErpProScrapSheet scrapSheet); |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ErpProScrapSheetDetail> scrapSheetDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); |
| | | } |
| | | } |
| | |
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_ProOutOrder proOutOrder, Dt_ProOutOrderDetail proOutOrderDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); |
| | | //å¤çæåºåºåºè¯¦æ
|
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_MesRworkOutboundOrder mesOutboundOrder, Dt_ProStockInfo outStock, float assignQuantity, int? taskNum = null); |
| | | /// <summary> |
| | | /// æåæ¥åºåºåºè¯¦æ
|
| | | /// </summary> |
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_ErpProScrapSheet proScrapSheet, Dt_ErpProScrapSheetDetail scrapSheetDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); |
| | | List<Dt_OutProStockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus); |
| | | } |
| | | } |
| | |
| | | |
| | | IMesRworkOutboundOrderService RworkOutboundOrderService { get; } |
| | | IErpProTransferOrderService ErpProTransferOrderService { get; } |
| | | IErpProScrapSheetService ErpProScrapSheetService { get; } |
| | | IErpProScrapSheetDetailService ErpProScrapSheetDetailService { get;} |
| | | } |
| | | } |
| | |
| | | /// è·åæååºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder, List<string> locationInfos); |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_ErpProScrapSheetDetail erpProScrapSheetDetail, List<string> locationInfos); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder); |
| | | |
| | | List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ErpProScrapSheetDetail erpProScrapSheetDetail); |
| | | /// <summary> |
| | | /// è·åMESæåºåºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity); |
| | | /// <summary> |
| | | /// è·åæåæ¥åºçåºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity); |
| | | } |
| | | } |
| | |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade); |
| | | Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade); |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |
| | | /// </summary> |
| | |
| | | /// å·²æ ¸å<br/> |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¥åºç¶æ")] |
| | | public string ProScrapStatus { get; set; } |
| | | public int ProScrapStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | |
| | | public int ScrapPcsQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éå®PCSæ° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æ¥åºPCSæ°")] |
| | | public int LockPcsQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å·²æ¥åºSETæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "已䏿¥åºSETæ°é")] |
| | |
| | | public IProOutOrderRepository ProOutOrderRepository { get; } |
| | | public IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } |
| | | public IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } |
| | | public IErpProScrapSheetRepository ErpProScrapSheetRepository { get;} |
| | | public IErpProScrapSheetDetailRepository ErpProScrapDetailRepository { get;} |
| | | |
| | | public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository, IProOutOrderRepository proOutOrderRepository, IProOutOrderDetailRepository proOutOrderDetailRepository, IMesRworkOutboundOrderRepository rworkOutboundOrderRepository) |
| | | public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository, IProOutOrderRepository proOutOrderRepository, IProOutOrderDetailRepository proOutOrderDetailRepository, IMesRworkOutboundOrderRepository rworkOutboundOrderRepository, IErpProScrapSheetRepository erpProScrapSheetRepository, IErpProScrapSheetDetailRepository erpProScrapSheetDetailRepository) |
| | | { |
| | | OutboundOrderDetailRepository = outboundOrderDetailRepository; |
| | | OutboundOrderRepository = outboundOrderRepository; |
| | |
| | | ProOutOrderRepository = proOutOrderRepository; |
| | | ProOutOrderDetailRepository = proOutOrderDetailRepository; |
| | | RworkOutboundOrderRepository = rworkOutboundOrderRepository; |
| | | ErpProScrapSheetRepository= erpProScrapSheetRepository; |
| | | ErpProScrapDetailRepository = erpProScrapSheetDetailRepository; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_External.ERPService; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_OutboundRepository; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | | { |
| | |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public IErpProScrapSheetDetailRepository Repository => BaseDal; |
| | | public IErpProScrapSheetRepository _proScrapSheetRepository; |
| | | public IInvokeERPService _invokeERPService; |
| | | public IStockRepository _stockRepository; |
| | | public IStockService _stockService; |
| | | public IOutProStockInfoService _outProStockInfoService; |
| | | public IBasicService _basicService; |
| | | public IRecordService _recordService; |
| | | |
| | | public ErpProScrapSheetDetailService(IErpProScrapSheetDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | public ErpProScrapSheetDetailService(IErpProScrapSheetDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IErpProScrapSheetRepository proScrapSheetRepository, IInvokeERPService invokeERPService, IStockRepository stockRepository, IStockService stockService, IOutProStockInfoService outProStockInfoService, IRecordService recordService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _proScrapSheetRepository = proScrapSheetRepository; |
| | | _invokeERPService = invokeERPService; |
| | | _stockRepository = stockRepository; |
| | | _stockService = stockService; |
| | | _outProStockInfoService = outProStockInfoService; |
| | | _recordService = recordService; |
| | | } |
| | | //è·å对åºåå·çæ¥åºæç» |
| | | public List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo) |
| | | { |
| | | List<Dt_ErpProScrapSheetDetail> proScrapSheetDetails = _proScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet, Dt_ErpProScrapSheetDetail>((master, detail) => master.Id == detail.ProScrapSheetId) |
| | | .Where((master, detail) => master.ProScrapSheetOrderNo==scrapNo) |
| | | .Select((master, detail) => detail) |
| | | .ToList(); |
| | | return proScrapSheetDetails; |
| | | } |
| | | /// <summary> |
| | | /// æäº¤æ¥åºæä½ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent UpProScrap(string scrapNo,int[] keys) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åææçæ¥åºæç» |
| | | Dt_ErpProScrapSheet erpProScrapSheet = _proScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == scrapNo).Includes(x => x.Details).First(); |
| | | if (erpProScrapSheet == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºæ¥åºå{scrapNo}"); |
| | | } |
| | | if (erpProScrapSheet.Details == null || erpProScrapSheet.Details.Count<=0) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºæ¥åºå{scrapNo}æç»"); |
| | | } |
| | | List<Dt_ErpProScrapSheetDetail> erpProScrapSheetDetails = erpProScrapSheet.Details.Where(x=> keys.Contains(x.Id) && x.ScrapProDetailStatus== OutOrderStatusEnum.åºåºå®æ.ObjToInt()).ToList(); |
| | | List<Dt_ErpProScrapSheetDetail> overDetails= erpProScrapSheet.Details.Where(x => x.ScrapProDetailStatus == OutOrderStatusEnum.å
³é.ObjToInt()).ToList(); |
| | | int overCount = overDetails.Count; |
| | | //è¿è¡æ¥åºæäº¤æä½ |
| | | if (erpProScrapSheetDetails.Count!= keys.Length) |
| | | { |
| | | return content.Error($"æäº¤äºå·²æ¥åºæç»ææ£å¨åºåºä¸,è¯·æ£æ¥"); |
| | | } |
| | | if ((overCount + keys.Length) == erpProScrapSheet.Details.Count) |
| | | { |
| | | erpProScrapSheet.ProScrapStatus = ProScrapSheetStatusEnum.Valid.ObjToInt(); |
| | | } |
| | | List<ScrapSheetItem> scrapSheetItems = new List<ScrapSheetItem>(); |
| | | foreach (var item in erpProScrapSheetDetails) |
| | | { |
| | | item.ScrapProDetailStatus = OutOrderStatusEnum.å
³é.ObjToInt(); |
| | | item.OverScrapPcsQty = item.ScrapPcsQty; |
| | | item.OverScrapSETQty = item.ScrapSETQty; |
| | | ScrapSheetItem scrapSheetItem = new ScrapSheetItem() |
| | | { |
| | | PartNum = item.ScrapProCode, |
| | | PartRev = item.ScrapProVersion, |
| | | Lotno = item.ScrapProVersion, |
| | | QtyOfArray = item.ScrapSETQty, |
| | | QtyOfUnit = item.ScrapPcsQty, |
| | | QtyOfArray_Alloc = 0, |
| | | QtyOfUnit_Alloc = 0, |
| | | }; |
| | | scrapSheetItems.Add(scrapSheetItem); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | _proScrapSheetRepository.UpdateData(erpProScrapSheet); |
| | | BaseDal.UpdateData(erpProScrapSheetDetails); |
| | | if (erpProScrapSheet.ProScrapStatus == ProScrapSheetStatusEnum.Valid.ObjToInt()) |
| | | { |
| | | ERPScrapSheetModel scrapSheetModel = new ERPScrapSheetModel() |
| | | { |
| | | Way = 1, |
| | | UniqueTag = erpProScrapSheet.Id.ToString(), |
| | | Code = erpProScrapSheet.ProScrapSheetOrderNo, |
| | | Status = ProScrapSheetStatusEnum.Valid.ToString(), |
| | | Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Createuser = erpProScrapSheet.Creater, |
| | | WarehouseCode = WarehouseEnum.HA71.ToString(), |
| | | DataItem = new List<ScrapSheetItem>() |
| | | }; |
| | | if (overCount>0) |
| | | { |
| | | foreach (var item in overDetails) |
| | | { |
| | | ScrapSheetItem scrapSheetItem = new ScrapSheetItem() |
| | | { |
| | | PartNum = item.ScrapProCode, |
| | | PartRev = item.ScrapProVersion, |
| | | Lotno = item.ScrapProVersion, |
| | | QtyOfArray = item.ScrapSETQty, |
| | | QtyOfUnit = item.ScrapPcsQty, |
| | | QtyOfArray_Alloc = 0, |
| | | QtyOfUnit_Alloc = 0, |
| | | }; |
| | | scrapSheetItems.Add(scrapSheetItem); |
| | | } |
| | | } |
| | | scrapSheetModel.DataItem = scrapSheetItems; |
| | | //ä¸ä¼ ERPæ¥åº |
| | | string response = _invokeERPService.InvokeProScrapSheetApi(scrapSheetModel); |
| | | ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); |
| | | if (requestContent.res != 1) |
| | | { |
| | | throw new Exception($"{requestContent.Data}"); |
| | | } |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æ¥åºæ°æ®å¤ç |
| | | /// </summary> |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ErpProScrapSheetDetail> scrapSheetDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | | { |
| | | //æ´æ°åºå屿§ |
| | | _stockService.ProStockInfoService.Repository.UpdateData(proStockInfos); |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in proStockInfos) |
| | | { |
| | | proStockInfoDetails.AddRange(item.proStockInfoDetails); |
| | | } |
| | | //æ´æ°åºåæç» |
| | | proStockInfoDetails.ForEach(x => x.ProOutDetailStatus = StockStatusEmun.åºåºéå®.ObjToInt()); |
| | | _stockService.ProStockInfoDetailService.Repository.UpdateData(proStockInfoDetails); |
| | | |
| | | BaseDal.UpdateData(scrapSheetDetails); |
| | | |
| | | List<Dt_OutProStockInfo> addOutStockLockInfos = outProStockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | if (tasks != null) |
| | | { |
| | | addOutStockLockInfos.ForEach(x => |
| | | { |
| | | x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; |
| | | }); |
| | | } |
| | | |
| | | _outProStockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutProStockInfo> updateOutStockLockInfos = outProStockInfos.Where(x => x.Id > 0).ToList(); |
| | | if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) |
| | | { |
| | | _outProStockInfoService.Repository.UpdateData(updateOutStockLockInfos); |
| | | } |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); |
| | | _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ErpProScrapSheetDetail> proOutOrderDetails, Dt_ErpProScrapSheet scrapSheet) |
| | | { |
| | | List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //List<Dt_ProOutOrderDetail> groupDetails = proOutOrderDetails.GroupBy(x => new { x.SaleOrder, x.PCode, x.PVer, x.PLot, x.DateCode }).Select(x => new Dt_ProOutOrderDetail() |
| | | //{ |
| | | // QtyPcs = x.Sum(x => x.QtyPcs) - x.Sum(x => x.OverQtyPcs), |
| | | // SaleOrder = x.Key.SaleOrder, |
| | | // PCode = x.Key.PCode, |
| | | // PVer = x.Key.PVer, |
| | | // PLot = x.Key.PLot, |
| | | // DateCode = x.Key.DateCode, |
| | | //}).ToList(); |
| | | //foreach (var item in groupDetails) |
| | | //{ |
| | | // float needQty = item.QtyPcs; |
| | | // //æ¥æ¾å¯ç¨åºå |
| | | // List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item); |
| | | // if (!stockInfoss.Any()) |
| | | // { |
| | | // throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | | // } |
| | | // //è·ååºåºåºå |
| | | // List<Dt_ProStockInfo> assignOutStocks = _stockInfoService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); |
| | | // item.LockQtyPcs += needQty - residueQuantity; |
| | | // if (item.QtyPcs> item.LockQtyPcs) |
| | | // { |
| | | // throw new Exception($"产åç¼ç {item.PCode}å¯åé
æ°éä¸è¶³,å¯ç¨æ°é{item.LockQtyPcs}"); |
| | | // } |
| | | // outStocks.AddRange(assignOutStocks); |
| | | // float assignQuantity = needQty - residueQuantity; |
| | | // bool isCanLot = string.IsNullOrEmpty(item.PLot); |
| | | // bool isCanDate = string.IsNullOrEmpty(item.DateCode); |
| | | // List<Dt_ProOutOrderDetail> details = proOutOrderDetails |
| | | // .Where(x =>x.PCode == item.PCode && x.PVer == item.PVer |
| | | // && (isCanLot ? isCanLot : x.PLot == item.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == item.DateCode)) |
| | | // .ToList(); |
| | | |
| | | // for (int i = 0; i < details.Count; i++) |
| | | // { |
| | | // float orderQuantity = details[i].QtyPcs; |
| | | // for (int j = 0; j < assignOutStocks.Count; j++) |
| | | // { |
| | | // //åºåºè®¢åæç»å·²åé
æ°é |
| | | // float detailAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer |
| | | // && (isCanLot ? isCanLot : x.PLot == item.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) |
| | | // && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity); |
| | | |
| | | // float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer |
| | | // && (isCanLot ? isCanLot : x.PLot == item.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) |
| | | // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity); |
| | | // //åºåºè¯¦æ
å·²åé
æ°é |
| | | // palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer |
| | | // && (isCanLot ? isCanLot : x.PLot == item.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) |
| | | // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity);//åºåºè¯¦æ
å·²åé
æ°é |
| | | // float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); |
| | | // if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | // { |
| | | // float orderDetailNeedQuantity = details[i].QtyPcs - detailAssignQuantity; |
| | | // if (orderDetailNeedQuantity > assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | // { |
| | | // details[i].LockQtyPcs += assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | // Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity); |
| | | // outProStockInfos.Add(outStockLockInfo); |
| | | // } |
| | | // else |
| | | // { |
| | | // Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], details[i].QtyPcs - details[i].LockQtyPcs); |
| | | // outProStockInfos.Add(outStockLockInfo); |
| | | // details[i].LockQtyPcs = details[i].QtyPcs; |
| | | // break; |
| | | // } |
| | | |
| | | // } |
| | | // } |
| | | // } |
| | | // List<string> locationArr = outStocks.Select(x => x.LocationCode).ToList(); |
| | | |
| | | // locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); |
| | | |
| | | //} |
| | | foreach (var item in proOutOrderDetails) |
| | | { |
| | | float needQty = item.ScrapPcsQty; |
| | | //æ¥æ¾å¯ç¨åºå |
| | | List<Dt_ProStockInfo> stockInfoss = _stockService.ProStockInfoService.GetUseableStocks(scrapSheet.WarehouseId, item); |
| | | if (!stockInfoss.Any()) |
| | | { |
| | | throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | //è·ååºåºåºå |
| | | List<Dt_ProStockInfo> assignOutStocks = _stockService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); |
| | | item.LockPcsQty += (int)(needQty - residueQuantity); |
| | | if (item.ScrapPcsQty > item.LockPcsQty) |
| | | { |
| | | throw new Exception($"产åç¼ç {item.ScrapProCode}å¯åé
æ°éä¸è¶³,å¯ç¨æ°é{item.LockPcsQty}"); |
| | | } |
| | | outStocks.AddRange(assignOutStocks); |
| | | item.LockPcsQty = 0; |
| | | for (int j = 0; j < assignOutStocks.Count; j++) |
| | | { |
| | | //åºåºè®¢åæç»å·²åé
æ°é |
| | | float detailAssignQuantity = outProStockInfos.Where(x => x.OrderDetailId == item.Id).Sum(x => x.AssignQuantity); |
| | | ////åºåºè¯¦æ
å·²åé
æ°é |
| | | //float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer |
| | | // && (isCanLot ? isCanLot : x.PLot == item.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) |
| | | // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity); |
| | | ////åºåºè¯¦æ
å·²åé
æ°é |
| | | //float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); |
| | | //if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | //{ |
| | | float orderDetailNeedQuantity = item.ScrapPcsQty - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity)) |
| | | { |
| | | item.LockPcsQty += (int)assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(scrapSheet, item, assignOutStocks[j], assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity)); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(scrapSheet, item, assignOutStocks[j], item.ScrapPcsQty - detailAssignQuantity); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | item.LockPcsQty = item.ScrapPcsQty; |
| | | break; |
| | | } |
| | | //} |
| | | } |
| | | List<string> locationArr = outStocks.Select(x => x.LocationCode).ToList(); |
| | | |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); |
| | | |
| | | } |
| | | return (outStocks, proOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | if (!item.ContainsKey(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower())) |
| | | { |
| | | item.Add(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower(), OutOrderStatusEnum.åºåºä¸.ObjToInt()); |
| | | item.Add(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower(), OutOrderStatusEnum.æªå¼å§.ObjToInt()); |
| | | } |
| | | } |
| | | return base.AddData(saveModel); |
| | |
| | | |
| | | return outProStockInfo; |
| | | } |
| | | /// <summary> |
| | | /// æåæ¥åºåºåºè¯¦æ
|
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Dt_OutProStockInfo GetOutStockLockInfo(Dt_ErpProScrapSheet proScrapSheet, Dt_ErpProScrapSheetDetail scrapSheetDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null) |
| | | { |
| | | Dt_OutProStockInfo outProStockInfo = new Dt_OutProStockInfo() |
| | | { |
| | | OrderNo = proScrapSheet.ProScrapSheetOrderNo, |
| | | OrderDetailId = scrapSheetDetail.Id, |
| | | OrderType = 1, |
| | | BatchNo = scrapSheetDetail.ScrapProLotNo, |
| | | SaleOrder = "", |
| | | Customer = "", |
| | | PCode = scrapSheetDetail.ScrapProCode, |
| | | PVer = scrapSheetDetail.ScrapProVersion, |
| | | PLot = proStockInfo.proStockInfoDetails.FirstOrDefault()?.LotNumber ?? "", |
| | | DateCode = proStockInfo.proStockInfoDetails.FirstOrDefault()?.DateCode ?? "", |
| | | StockId = proStockInfo.Id, |
| | | OrderQuantity = scrapSheetDetail.ScrapPcsQty, |
| | | OriginalQuantity = proStockInfo.proStockInfoDetails.Sum(x => x.StockPcsQty), |
| | | AssignQuantity = assignQty, |
| | | LocationCode = proStockInfo.LocationCode, |
| | | PalletCode = proStockInfo.PalletCode, |
| | | Unit = "PCS", |
| | | TaskNum = taskNum, |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt() |
| | | }; |
| | | return outProStockInfo; |
| | | } |
| | | public List<Dt_OutProStockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus) |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt()); |
| | |
| | | public IMesRworkOutboundOrderService RworkOutboundOrderService { get; } |
| | | public IErpProTransferOrderService ErpProTransferOrderService { get; } |
| | | |
| | | |
| | | public OutboundService(IOutboundOrderDetailService outboundOrderDetailService, IMesRworkOutboundOrderService rworkOutboundOrderService,IMesPPOutboundOrderDetailService mesPPOutboundOrderDetailService, IMesPPCutOutboundOrderDetailService mesPPCutOutboundOrderDetailService, IMesPPCutOutboundOrderService mesPPCutOutboundOrderService, IMesPPOutboundOrderService mesPPOutboundOrderService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IMesOutboundOrderService mesOutboundOrderService,IProOutOrderService proOutOrderService, IProOutOrderDetailService proOutOrderDetailService,IErpProTransferOrderService erpProTransferOrderService) |
| | | public IErpProScrapSheetService ErpProScrapSheetService { get; } |
| | | public IErpProScrapSheetDetailService ErpProScrapSheetDetailService { get; } |
| | | public OutboundService(IOutboundOrderDetailService outboundOrderDetailService, IMesRworkOutboundOrderService rworkOutboundOrderService,IMesPPOutboundOrderDetailService mesPPOutboundOrderDetailService, IMesPPCutOutboundOrderDetailService mesPPCutOutboundOrderDetailService, IMesPPCutOutboundOrderService mesPPCutOutboundOrderService, IMesPPOutboundOrderService mesPPOutboundOrderService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IMesOutboundOrderService mesOutboundOrderService,IProOutOrderService proOutOrderService, IProOutOrderDetailService proOutOrderDetailService,IErpProTransferOrderService erpProTransferOrderService, |
| | | IErpProScrapSheetService erpProScrapSheetService, IErpProScrapSheetDetailService erpProScrapSheetDetailService) |
| | | { |
| | | OutboundOrderDetailService = outboundOrderDetailService; |
| | | OutboundOrderService = outboundOrderService; |
| | |
| | | ProOutOrderDetailService = proOutOrderDetailService; |
| | | RworkOutboundOrderService = rworkOutboundOrderService; |
| | | ErpProTransferOrderService = erpProTransferOrderService; |
| | | ErpProScrapSheetService = erpProScrapSheetService; |
| | | ErpProScrapSheetDetailService = erpProScrapSheetDetailService; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | //æ´æ°åºåºæç»åæ°é |
| | | proOutOrderDetail.OverQtyPcs += item.Quantity; |
| | | item.Quantity -= item.Quantity; |
| | | float Range = itemOut.StockPcsQty / itemOut.SETQty; |
| | | int Range = (int)itemOut.StockPcsQty / (int)itemOut.SETQty; |
| | | if (Range == 0) |
| | | { |
| | | return content.Error($"{itemOut.BagNo}åå
æ°é转æ¢å¤±è´¥,è¯·æ£æ¥"); |
| | | return content.Error($"{itemOut.BagNo}åå
æ°é转æ¢å¤±è´¥,è¯·æ£æ¥,Range:{Range}"); |
| | | } |
| | | int outSet = (int)(item.Quantity / Range); |
| | | int outSet =item.Quantity / Range; |
| | | if (outSet == 0) |
| | | { |
| | | return content.Error($"{itemOut.BagNo}åå
æ°é转æ¢å¤±è´¥,è¯·æ£æ¥"); |
| | | return content.Error($"{itemOut.BagNo}åå
æ°é转æ¢å¤±è´¥,è¯·æ£æ¥,outSet:{outSet}"); |
| | | } |
| | | itemOut.SETQty -= outSet; |
| | | |
| | | itemOut.StockPcsQty -= item.Quantity; |
| | | item.Quantity = 0; |
| | | if (proOutOrderDetail.OverQtyPcs > proOutOrderDetail.QtyPcs) |
| | | { |
| | | return content.Error($"åºåºå{proOutOrder.ProOutOrderNo}éå®è®¢å{item.SoNumber}æ°é溢åº{proOutOrderDetail.OverQtyPcs - proOutOrderDetail.QtyPcs}"); |
| | |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x => x.proStockInfoDetails.Sum(x => x.StockPcsQty)).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | /// <summary> |
| | | /// è·åMESæåºåºå(å°¾æ°ä») |
| | | /// </summary> |
| | | /// <param name="mesRworkOutboundOrder"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_ErpProScrapSheetDetail erpProScrapSheetDetail, List<string> locationInfos) |
| | | { |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode) && x.ProStockAttribute == ProStockAttributeEnum.æå.ObjToInt()) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails |
| | | .Any(v => |
| | | v.ProductCode == erpProScrapSheetDetail.ScrapProLotNo |
| | | && v.ProductCode == erpProScrapSheetDetail.ScrapProCode |
| | | && v.ProductVersion == erpProScrapSheetDetail.ScrapProVersion |
| | | )) |
| | | .ToList(); |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x => x.proStockInfoDetails.Sum(x => x.StockPcsQty)).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | } |
| | | } |
| | |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehouse.WarehouseId); |
| | | return BaseDal.GetProStocks(mesRworkOutboundOrder, locationCodes); |
| | | } |
| | | //æ¥æ¾å¯ç¨æ¥åºåºå |
| | | public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ErpProScrapSheetDetail erpProScrapSheetDetail) |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); |
| | | return BaseDal.GetProStocks(erpProScrapSheetDetail, locationCodes); |
| | | } |
| | | /// <summary> |
| | | /// è·ååºåºåºå |
| | | /// </summary> |
| | |
| | | return assignOutStocks; |
| | | } |
| | | /// <summary> |
| | | /// è·åæ¥åºåºå |
| | | /// </summary> |
| | | public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity) |
| | | { |
| | | List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>(); |
| | | float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); |
| | | //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); |
| | | if (stockTotalQuantity >= needQuantity)//åºåå¤ |
| | | { |
| | | int index = 0; |
| | | while (needQuantity > 0) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[index]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => |
| | | x.ProductCode == outOrderDetail.ScrapProCode |
| | | && x.ProductVersion==outOrderDetail.ScrapProVersion |
| | | && x.LotNumber == outOrderDetail.ScrapProLotNo) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity && useableStockQuantity > 0) |
| | | { |
| | | stockInfo.proStockInfoDetails.Where(x => |
| | | x.ProductCode == outOrderDetail.ScrapProCode |
| | | && x.ProductVersion == outOrderDetail.ScrapProVersion |
| | | && x.LotNumber == outOrderDetail.ScrapProLotNo).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | //满足æ¡ä»¶è¿è¡åé
|
| | | if ((x.StockPcsQty > x.OutboundQuantity) |
| | | && x.ProductCode == outOrderDetail.ScrapProCode |
| | | && x.ProductVersion == outOrderDetail.ScrapProVersion |
| | | && x.LotNumber == outOrderDetail.ScrapProLotNo) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | x.OutDetailId = outOrderDetail.Id; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockPcsQty; |
| | | x.OutDetailId = outOrderDetail.Id; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | assignOutStocks.Add(stockInfo); |
| | | index++; |
| | | } |
| | | } |
| | | residueQuantity = needQuantity; |
| | | return assignOutStocks; |
| | | } |
| | | /// <summary> |
| | | /// è·åMESæåºåºå |
| | | /// </summary> |
| | | public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity) |
| | |
| | | case (int)TaskTypeEnum.OutMesRworkProduct: |
| | | content = OutMesRworkCompleted(task); |
| | | break; |
| | | case (int)TaskTypeEnum.OutProScrap: |
| | | content = OutProScrapCompleted(task); |
| | | break; |
| | | default: |
| | | content.Error("æªç¥ä»»å¡ç±»å"); |
| | | break; |
| | |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent OutProScrapCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åè´§ä½ |
| | | Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | if (locationInfo == null) |
| | | { |
| | | return content.Error("æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | //æ ¹æ®ä»»å¡è·åæååºåºè¯¦æ
ä»»å¡åç©æä¿¡æ¯ |
| | | Dt_OutProStockInfo outProStockInfo = _outProStockInfoRepository.QueryFirst(x => x.TaskNum == task.TaskNum); |
| | | if (outProStockInfo == null) |
| | | { |
| | | return content.Error("æªæ¾å°æååºåºè¯¦æ
"); |
| | | } |
| | | //è·åæåæ¥åºå |
| | | |
| | | Dt_ErpProScrapSheet erpProScrapSheet = _outboundRepository.ErpProScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == outProStockInfo.OrderNo).Includes(x=>x.Details).First(); |
| | | if (erpProScrapSheet == null) |
| | | { |
| | | return content.Error("æªæ¾å°æåæ¥åºå"); |
| | | } |
| | | Dt_ErpProScrapSheetDetail erpProScrapSheetDetail = erpProScrapSheet.Details.FirstOrDefault(x => x.Id == outProStockInfo.OrderDetailId); |
| | | if (erpProScrapSheetDetail == null) |
| | | { |
| | | return content.Error("æªæ¾å°æåæ¥åºåæç»"); |
| | | } |
| | | if (erpProScrapSheetDetail.ScrapProDetailStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | return content.Error($"æåæ¥åºåæç»è¡{erpProScrapSheetDetail.Id}已宿"); |
| | | } |
| | | erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | //è·åå½ååºå |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First(); |
| | | if (proStockInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°{task.PalletCode}åºåä¿¡æ¯"); |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails; |
| | | if (proStockInfoDetails.Count <= 0) |
| | | { |
| | | return content.Error("æååºåæç»ä¸ºç©º"); |
| | | } |
| | | proStockInfoDetails.ForEach(x => |
| | | { |
| | | x.OutboundQuantity = 0; |
| | | x.ProOutDetailStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | }); |
| | | proStockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | //è·åæåå¹³åº |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | proStockInfo.WarehouseId = warehouse.WarehouseId; |
| | | proStockInfo.LocationCode = "æåå
è£
æ£è´§åº"; |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | outProStockInfo.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //è´§ä½åå¨è®°å½ |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.Free, locationInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, erpProScrapSheet?.ProScrapSheetOrderNo ?? "", task.TaskNum); |
| | | _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); |
| | | _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfoDetails); |
| | | _outProStockInfoRepository.UpdateData(outProStockInfo); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | //MESæååºåæ¿åºåºåæ¥ |
| | | //WebResponseContent responseContent = ProductOutBoundSync(MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails)); |
| | | //if (!responseContent.Status) |
| | | //{ |
| | | // throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:"+ responseContent.Message); |
| | | //} |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// çç¹åºåºå®æ |
| | | /// </summary> |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// çææåæ¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (StationCode.IsNullOrEmpty()) |
| | | { |
| | | return await Task.FromResult(content.Error("å
é¨é误")); |
| | | } |
| | | //è·åæåæ¥åºè®¢å |
| | | List<Dt_ErpProScrapSheetDetail> _ProOutOrderDetails = await _outboundRepository.ErpProScrapDetailRepository.QueryDataAsync(x => keys.Contains(x.Id) && x.ScrapProDetailStatus == OutOrderStatusEnum.æªå¼å§.ObjToInt()); |
| | | if (_ProOutOrderDetails.Count <= 0) |
| | | { |
| | | return await Task.FromResult(content.Error("å¾é订åæç»ç¶æä¸ºåºåºä¸")); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ErpProScrapSheetDetail> proOutOrderDetails = new List<Dt_ErpProScrapSheetDetail>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ErpProScrapSheetDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result = |
| | | OutProScrapTaskDataHandle(_ProOutOrderDetails); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | proStockInfos.AddRange(result.Item2); |
| | | } |
| | | if (result.Item3 != null && result.Item3.Count > 0) |
| | | { |
| | | proOutOrderDetails.AddRange(result.Item3); |
| | | } |
| | | if (result.Item4 != null && result.Item4.Count > 0) |
| | | { |
| | | outProStockInfos.AddRange(result.Item4); |
| | | } |
| | | if (result.Item5 != null && result.Item5.Count > 0) |
| | | { |
| | | locationInfos.AddRange(result.Item5); |
| | | } |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | Dt_Task? task = BaseDal.QueryData(x => x.TaskType == TaskTypeEnum.OutProScrap.ObjToInt()).OrderBy(x => x.Grade).FirstOrDefault(); |
| | | //æ´æ°åºåºç®çä½ç½® |
| | | result.Item1.ForEach(x => |
| | | { |
| | | x.TargetAddress = StationCode; |
| | | if (Grade == 1 || task == null) |
| | | { |
| | | x.Grade = 127; |
| | | } |
| | | else |
| | | { |
| | | if (task.Grade == 0 || task.Grade == 1) |
| | | { |
| | | x.Grade = 1; |
| | | } |
| | | else |
| | | { |
| | | x.Grade = task.Grade - 1; |
| | | } |
| | | } |
| | | }); |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | //å¤çåºåºæ°æ® |
| | | return await Task.FromResult(GenerateOutboundTaskDataUpdate(tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// 人工éå®åºååºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// å¤çåºåºæ°æ® |
| | | /// </summary> |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_ProStockInfo>? proStockInfos = null, List<Dt_ErpProScrapSheetDetail>? scrapSheetDetails = null, List<Dt_OutProStockInfo>? outProStockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | //è·åæååºåºå主表 |
| | | Dt_ErpProScrapSheet scrapSheet = _outboundRepository.ErpProScrapSheetRepository.QueryFirst(x => x.Id == scrapSheetDetails.FirstOrDefault().ProScrapSheetId); |
| | | BaseDal.AddData(tasks); |
| | | if (proStockInfos != null && proStockInfos.Count > 0 && scrapSheetDetails != null && scrapSheetDetails.Count > 0 && outProStockInfos != null && outProStockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | proStockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | WebResponseContent content = _outboundService.ErpProScrapSheetDetailService.LockOutboundStockDataUpdate(proStockInfos, scrapSheetDetails, outProStockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content; |
| | | } |
| | | } |
| | | else if (scrapSheetDetails != null && scrapSheetDetails.Count > 0) |
| | | { |
| | | scrapSheetDetails.ForEach(x => |
| | | { |
| | | x.ScrapProDetailStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | _outboundRepository.ErpProScrapDetailRepository.UpdateData(scrapSheetDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// å¤çæååºåºæ°æ® |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | } |
| | | return (tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ErpProScrapSheetDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProScrapTaskDataHandle(List<Dt_ErpProScrapSheetDetail> scrapSheetDetails) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ErpProScrapSheetDetail> assignOutOrderDetails = new List<Dt_ErpProScrapSheetDetail>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | //è·åæ¥åºå |
| | | Dt_ErpProScrapSheet scrapSheet = _outboundRepository.ErpProScrapSheetRepository.QueryFirst(x => x.Id == scrapSheetDetails.FirstOrDefault().ProScrapSheetId); |
| | | if (scrapSheet == null) |
| | | { |
| | | throw new Exception("æªæ¾å°æåæ¥åºè®¢å"); |
| | | } |
| | | //åé
åºå |
| | | (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ErpProScrapSheetDetailService.AssignProStockOut(scrapSheetDetails, scrapSheet); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | TaskTypeEnum typeEnum = TaskTypeEnum.OutProScrap; |
| | | tasks = GetTasks(result.Item1, typeEnum); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.ScrapProDetailStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | tasks.ForEach(x => x.OrderNo = scrapSheet.ProScrapSheetOrderNo); |
| | | proStockInfos = result.Item1; |
| | | assignOutOrderDetails = result.Item2; |
| | | outProStockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ å¯åé
åºå"); |
| | | } |
| | | return (tasks, proStockInfos, assignOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | /// <summary> |
| | | /// çæä»»å¡ |
| | | /// </summary> |
| | |
| | | { |
| | | return MesResponseContent.Instance.Error(responseContent.Message); |
| | | } |
| | | model.Content.CreatorCode = "QMS"; |
| | | string content = _invokeERPService.InvokeCheckOrderApi(model.Content); |
| | | ErpRequestContent requestContent = content.DeserializeObject<ErpRequestContent>(); |
| | | if (requestContent.res != 1) |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | { |
| | | |
| | | } |
| | | /// <summary> |
| | | /// æ¥åºåæç»æ¥è¯¢ |
| | | /// </summary> |
| | | [HttpPost, Route("GetByDetails"), AllowAnonymous] |
| | | public List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo) |
| | | { |
| | | return Service.GetByDetails(scrapNo); |
| | | } |
| | | [HttpPost, Route("UpProScrap"), AllowAnonymous] |
| | | public WebResponseContent UpProScrap([FromBody] int[] keys, string scrapNo) |
| | | { |
| | | return Service.UpProScrap(scrapNo,keys); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return await Service.OutProductTask(keys, StationCode, Grade); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çææåæ¥åºä»»å¡ |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("OutProScrapTask"), AllowAnonymous] |
| | | public async Task<WebResponseContent> OutProScrapTask([FromBody] int[] keys, string StationCode, int Grade) |
| | | { |
| | | return await Service.OutProScrapTask(keys, StationCode, Grade); |
| | | } |
| | | ///// <summary> |
| | | ///// çæMESPPä»å¤§å·åºåºä»»å¡ |
| | | ///// </summary> |