From 9b71c705751224d1adfb2706a0a7f8cb958ff488 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期四, 22 十二月 2022 16:38:24 +0800 Subject: [PATCH] 条码状态变更,设备备品备件 --- WebAPI/Controllers/SBGL/Sb_EquipSparepartsChangeBillController.cs | 290 +++++++++ Model/仓库管理/条码管理/ClsKF_BarCodeStatusChangeBillMain.cs | 13 Model/生产管理/设备管理/ClsSb_EquipSparepartsBillSub.cs | 18 Model/Model.csproj | 6 Model/生产管理/设备管理/ClsSb_EquipSparepartsBillMain.cs | 15 DAL/生产管理/设备管理/ClsSb_EquipSparepartsBill.cs | 229 +++++++ WebAPI/Controllers/WebAPIController.cs | 118 +++ Model/生产管理/设备管理/ClsSb_EquipSparepartsChangeBillSub.cs | 19 DAL/仓库管理/条码管理/ClsKF_BarCodeStatusChangeBill.cs | 224 +++++++ WebAPI/Controllers/仓存管理/条码生成/KF_BarCodeStatusChangeBillController.cs | 285 +++++++++ WebAPI/Controllers/SBGL/Sb_EquipSparepartsBillController.cs | 290 +++++++++ Model/仓库管理/条码管理/ClsKF_BarCodeStatusChangeBillSub.cs | 19 DAL/DAL.csproj | 3 DAL/生产管理/设备管理/ClsSb_EquipSparepartsChangeBill.cs | 230 +++++++ Model/生产管理/设备管理/ClsSb_EquipSparepartsChangeBillMain.cs | 15 WebAPI/WebAPI.csproj | 6 16 files changed, 1,780 insertions(+), 0 deletions(-) diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj index a011b5f..18fd31d 100644 --- a/DAL/DAL.csproj +++ b/DAL/DAL.csproj @@ -83,6 +83,7 @@ <Compile Include="浜轰簨绠$悊\ClsHR_EmpFosterBill.cs" /> <Compile Include="浜轰簨绠$悊\ClsHR_EmpUpChangeBill.cs" /> <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsGy_BarCodeBill_ChaiMa.cs" /> + <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsKF_BarCodeStatusChangeBill.cs" /> <Compile Include="鍩虹璧勬枡\InterFace鍩虹璧勬枡\ClsIF_ORGANIZATIONS_View.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CustLocation_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_Operator_Ctl.cs" /> @@ -599,6 +600,8 @@ <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldProdOutInBill.cs" /> <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldRepairInBill.cs" /> <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldRepairOutBill.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsBill.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsChangeBill.cs" /> <Compile Include="璐ㄦ绠$悊\ClsQC_FirstPieceCheckBill.cs" /> <Compile Include="璐ㄦ绠$悊\ClsQC_LastPieceCheckBill.cs" /> <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdCheckBill.cs" /> diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBill.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBill.cs" new file mode 100644 index 0000000..e4e6663 --- /dev/null +++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBill.cs" @@ -0,0 +1,224 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace DAL +{ + public class ClsKF_BarCodeStatusChangeBill : DBUtility.ClsXt_BaseBill + { + public Model.ClsKF_BarCodeStatusChangeBillMain omodel = new Model.ClsKF_BarCodeStatusChangeBillMain(); + public List<Model.ClsKF_BarCodeStatusChangeBillSub> DetailColl = new List<Model.ClsKF_BarCodeStatusChangeBillSub>(); + + public ClsKF_BarCodeStatusChangeBill() + { + base.MvarItemKeySub = "KF_BarCodeStatusChangeBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey = "KF_BarCodeStatusChangeBillMain"; + base.MvarReportTitle = "鏉$爜鐘舵�佸彉鏇村崟"; + base.BillType = "1288"; + base.HBillSubType = "1288"; + } + + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate KF_BarCodeStatusChangeBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus=" + omodel.HBillStatus.ToString() + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsKF_BarCodeStatusChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into KF_BarCodeStatusChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HBarCode,HBarCodeStatus_Old,HBarCodeStatus_New,HAuxPropID_Old,HAuxPropID_New,HMTONo_Old,HMTONo_New" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HBarCode + "','" + oSub.HBarCodeStatus_Old + "','" + oSub.HBarCodeStatus_New + "'," + oSub.HAuxPropID_Old.ToString() + "," + oSub.HAuxPropID_New.ToString() + ",'" + oSub.HMTONo_Old + + "','" + oSub.HMTONo_New + "'" + ") "); + } + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID)) + { + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + } + if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + // + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into KF_BarCodeStatusChangeBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HEmpID,HDeptID" + + ",HBillStatus,HBackRemark,HMaker,HMakeDate,HMainSourceBillType" + + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HPrintQty" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + + ", " + omodel.HEmpID.ToString() + "," + omodel.HDeptID.ToString() + "," + 1 + ",'" + omodel.HBackRemark + + "','" + omodel.HMaker + "','" + omodel.HMakeDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID + + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "'," + omodel.HPrintQty + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsKF_BarCodeStatusChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into KF_BarCodeStatusChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HHBarCode,HBarCodeStatus_Old,HBarCodeStatus_New,HAuxPropID_Old,HAuxPropID_New,HMTONo_Old,HMTONo_New" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HBarCode + "','" + oSub.HBarCodeStatus_Old + "','" + oSub.HBarCodeStatus_New + "'," + oSub.HAuxPropID_Old.ToString() + "," + oSub.HAuxPropID_New.ToString() + ",'" + oSub.HMTONo_Old + + "','" + oSub.HMTONo_New + "'" + ") "); + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏄剧ず鍗曟嵁 + public override bool ShowBill(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCn.RunProcReturn("Select * from KF_BarCodeStatusChangeBillMain Where HInterID=" + lngBillKey.ToString(), "KF_BarCodeStatusChangeBillMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]); + omodel.HBillStatus = 1; + omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); + omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); + omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); + omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]); + omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]); + omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]); + omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]); + omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]); + omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); + omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]); + omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]); + omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]); + omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]); + omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]); + omodel.HMainSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillType"]); + omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]); + omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]); + omodel.HMainSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillNo"]); + omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]); + //======================================================== + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from KF_BarCodeStatusChangeBillSub Where HInterID=" + lngBillKey.ToString(), "KF_BarCodeStatusChangeBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsKF_BarCodeStatusChangeBillSub oSub = new Model.ClsKF_BarCodeStatusChangeBillSub(); + // 鍥哄畾璧嬪��=============================================== + oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]); + oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + //=================================================== + oSub.HBarCode = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCode"]); + oSub.HBarCodeStatus_Old = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCodeStatus_Old"]); + oSub.HBarCodeStatus_New = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCodeStatus_New"]); + oSub.HAuxPropID_Old = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HAuxPropID_Old"]); + oSub.HAuxPropID_New = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HAuxPropID_New"]); + oSub.HMTONo_Old = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMTONo_Old"]); + oSub.HMTONo_New = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMTONo_New"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + } +} diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBill.cs" new file mode 100644 index 0000000..4083c5a --- /dev/null +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBill.cs" @@ -0,0 +1,229 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace DAL +{ + public class ClsSb_EquipSparepartsBill : DBUtility.ClsXt_BaseBill + { + public Model.ClsSb_EquipSparepartsBillMain omodel = new Model.ClsSb_EquipSparepartsBillMain(); + public List<Model.ClsSb_EquipSparepartsBillSub> DetailColl = new List<Model.ClsSb_EquipSparepartsBillSub>(); + + public ClsSb_EquipSparepartsBill() + { + base.MvarItemKeySub = "Sb_EquipSparepartsBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey = "Sb_EquipSparepartsBillMain"; + base.MvarReportTitle = "璁惧澶囧搧澶囦欢"; + base.BillType = "3980"; + base.HBillSubType = "3980"; + } + + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipSparepartsBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus=" + omodel.HBillStatus.ToString() + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HOrgID=" + omodel.HOrgID.ToString() + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSb_EquipSparepartsBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipSparepartsBillSub " + + " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HItemSubID,HMaterID,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + 0 + "," + oSub.HMaterID + "," + oSub.HQty + ",'" + oSub.HPartAddr + "'," + 0 + ",'" + oSub.HBeginDate + + "','" + oSub.HEndDate + "'" + ") "); + } + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID)) + { + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + } + if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + // + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipSparepartsBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HEmpID,HDeptID" + + ",HBillStatus,HBackRemark,HMaker,HMakeDate,HMainSourceBillType" + + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HPrintQty" + + ",HCheckItemNowID,HCheckItemNextID,HCheckFlowID,HBacker,HChecker,HUpDater,HCloseMan,HCloseType,HDeleteMan,HEquipID,HOrgID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + + ", " + omodel.HEmpID.ToString() + "," + omodel.HDeptID.ToString() + "," + 1 + ",'" + omodel.HBackRemark + + "','" + omodel.HMaker + "','" + omodel.HMakeDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID + + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "'," + omodel.HPrintQty + ",0,0,0" + ",'" + omodel.HBacker + + "','" + omodel.HChecker + "','" + omodel.HUpDater + "','" + omodel.HCloseMan + "'," + 0 + ",'" + omodel.HDeleteMan + + "'," + omodel.HEquipID + "," + omodel.HOrgID + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSb_EquipSparepartsBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipSparepartsBillSub " + + " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HItemSubID,HMaterID,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + 0 + "," + oSub.HMaterID + "," + oSub.HQty + ",'" + oSub.HPartAddr + "'," + 0 + ",'" + oSub.HBeginDate + + "','" + oSub.HEndDate + "'" + ") "); + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏄剧ず鍗曟嵁 + public override bool ShowBill(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCn.RunProcReturn("Select * from Sb_EquipSparepartsBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipSparepartsBillMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]); + omodel.HBillStatus = 1; + omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); + omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); + omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); + omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]); + omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]); + omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]); + omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]); + omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]); + omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); + omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]); + omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]); + omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]); + omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]); + omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]); + omodel.HMainSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillType"]); + omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]); + omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]); + omodel.HMainSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillNo"]); + omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]); + //======================================================== + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]); + + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipSparepartsBillSub Where HInterID=" + lngBillKey.ToString(), "Sb_EquipSparepartsBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSb_EquipSparepartsBillSub oSub = new Model.ClsSb_EquipSparepartsBillSub(); + // 鍥哄畾璧嬪��=============================================== + oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]); + oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPartAddr = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPartAddr"]); + oSub.HSNFlag = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSNFlag"]); + oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]); + oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + } +} diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBill.cs" new file mode 100644 index 0000000..5aee2fd --- /dev/null +++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBill.cs" @@ -0,0 +1,230 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace DAL +{ + public class ClsSb_EquipSparepartsChangeBill : DBUtility.ClsXt_BaseBill + { + public Model.ClsSb_EquipSparepartsChangeBillMain omodel = new Model.ClsSb_EquipSparepartsChangeBillMain(); + public List<Model.ClsSb_EquipSparepartsChangeBillSub> DetailColl = new List<Model.ClsSb_EquipSparepartsChangeBillSub>(); + + public ClsSb_EquipSparepartsChangeBill() + { + base.MvarItemKeySub = "Sb_EquipSparepartsChangeBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey = "Sb_EquipSparepartsChangeBillMain"; + base.MvarReportTitle = "璁惧澶囧搧澶囦欢鍙樻洿鍗�"; + base.BillType = "3981"; + base.HBillSubType = "3981"; + } + + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipSparepartsChangeBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus=" + omodel.HBillStatus.ToString() + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HOrgID=" + omodel.HOrgID.ToString() + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSb_EquipSparepartsChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipSparepartsChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HItemSubID,HMaterID_Old,HMaterID_New,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + 0 + "," + oSub.HMaterID_Old + "," + oSub.HMaterID_New + "," + oSub.HQty + ",'" + oSub.HPartAddr + "'," + 0 + ",'" + oSub.HBeginDate + + "','" + oSub.HEndDate + "'" + ") "); + } + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID)) + { + omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + } + if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + // + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipSparepartsChangeBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HEmpID,HDeptID" + + ",HBillStatus,HBackRemark,HMaker,HMakeDate,HMainSourceBillType" + + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HPrintQty" + + ",HCheckItemNowID,HCheckItemNextID,HCheckFlowID,HBacker,HChecker,HUpDater,HCloseMan,HCloseType,HDeleteMan,HEquipID,HOrgID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + + ", " + omodel.HEmpID.ToString() + "," + omodel.HDeptID.ToString() + "," + 1 + ",'" + omodel.HBackRemark + + "','" + omodel.HMaker + "','" + omodel.HMakeDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID + + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "'," + omodel.HPrintQty + ",0,0,0" + ",'" + omodel.HBacker + + "','" + omodel.HChecker + "','" + omodel.HUpDater + "','" + omodel.HCloseMan + "'," + 0 + ",'" + omodel.HDeleteMan + + "'," + omodel.HEquipID + "," + omodel.HOrgID + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSb_EquipSparepartsChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipSparepartsChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HItemSubID,HMaterID_Old,HMaterID_New,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + 0 + "," + oSub.HMaterID_Old + "," + oSub.HMaterID_New + "," + oSub.HQty + ",'" + oSub.HPartAddr + "'," + 0 + ",'" + oSub.HBeginDate + + "','" + oSub.HEndDate + "'" + ") "); + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏄剧ず鍗曟嵁 + public override bool ShowBill(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCn.RunProcReturn("Select * from Sb_EquipSparepartsChangeBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipSparepartsChangeBillMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]); + omodel.HBillStatus = 1; + omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); + omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); + omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); + omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]); + omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]); + omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]); + omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]); + omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]); + omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); + omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]); + omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]); + omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]); + omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]); + omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]); + omodel.HMainSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillType"]); + omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]); + omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]); + omodel.HMainSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillNo"]); + omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]); + //======================================================== + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]); + + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipSparepartsChangeBillSub Where HInterID=" + lngBillKey.ToString(), "Sb_EquipSparepartsChangeBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSb_EquipSparepartsChangeBillSub oSub = new Model.ClsSb_EquipSparepartsChangeBillSub(); + // 鍥哄畾璧嬪��=============================================== + oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]); + oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + //=================================================== + oSub.HMaterID_Old = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID_Old"]); + oSub.HMaterID_New = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID_New"]); + oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPartAddr = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPartAddr"]); + oSub.HSNFlag = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSNFlag"]); + oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]); + oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + } +} diff --git a/Model/Model.csproj b/Model/Model.csproj index 364ced3..6a0a47c 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -255,6 +255,8 @@ <Compile Include="浠撳簱绠$悊\ClsKf_ICStockBillScheme.cs" /> <Compile Include="浠撳簱绠$悊\ClsKf_ICStockBillSub.cs" /> <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsGy_BarCodeEdit_Model.cs" /> + <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsKF_BarCodeStatusChangeBillMain.cs" /> + <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsKF_BarCodeStatusChangeBillSub.cs" /> <Compile Include="浠撳簱绠$悊\铏氫粨绠$悊\ClsKf_VirtualStockInBillMain.cs" /> <Compile Include="浠撳簱绠$悊\铏氫粨绠$悊\ClsKf_VirtualStockInBillScheme.cs" /> <Compile Include="浠撳簱绠$悊\铏氫粨绠$悊\ClsKf_VirtualStockInBillSub.cs" /> @@ -582,6 +584,10 @@ <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairSendWorkBillMain.cs" /> <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairSendWorkBillSub.cs" /> <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairWorkBillSub_Mater.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsBillMain.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsBillSub.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsChangeBillMain.cs" /> + <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipSparepartsChangeBillSub.cs" /> <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_EquipMaintainBillSub_Item.cs" /> <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_EquipMaintainPlanBillSub_Item.cs" /> <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_ICMOBillMain.cs" /> diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillMain.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillMain.cs" new file mode 100644 index 0000000..ac8990a --- /dev/null +++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillMain.cs" @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +namespace Model +{ + public class ClsKF_BarCodeStatusChangeBillMain : DBUtility.ClsXt_BaseBillMain + { + + public Int64 HPrintQty; //鎵撳嵃娆℃暟 + public Int64 HEmpID; //鍙樻洿浜�(Gy_Employee) + public Int64 HDeptID; //璐熻矗閮ㄩ棬锛圙y_Department锛� + } +} diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillSub.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillSub.cs" new file mode 100644 index 0000000..ada7156 --- /dev/null +++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/\346\235\241\347\240\201\347\256\241\347\220\206/ClsKF_BarCodeStatusChangeBillSub.cs" @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsKF_BarCodeStatusChangeBillSub : DBUtility.ClsXt_BaseBillSub + { + public string HBillNo_bak; //鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級 + public string HBarCode; //鏉″舰鐮� + public string HBarCodeStatus_Old; //鍘熺姸鎬侊紙姝e父锛屽湪搴擄紝鍑哄簱锛屼綔搴燂紝闅旂锛屼笉鑹紝鎶ュ簾锛� + public string HBarCodeStatus_New; //鏂扮姸鎬侊紙姝e父锛屽湪搴擄紝鍑哄簱锛屼綔搴燂紝闅旂锛屼笉鑹紝鎶ュ簾锛� + public Int64 HAuxPropID_Old; //鍘熻緟鍔╁睘鎬� + public Int64 HAuxPropID_New; //鏂拌緟鍔╁睘鎬� + public string HMTONo_Old; //鍘烳TO鍙� + public string HMTONo_New; //鏂癕TO鍙� + public Int64 HItemSubID; + } +} diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillMain.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillMain.cs" new file mode 100644 index 0000000..e2a4bed --- /dev/null +++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillMain.cs" @@ -0,0 +1,15 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsSb_EquipSparepartsBillMain : DBUtility.ClsXt_BaseBillMain + { + public Int64 HPrintQty; //鎵撳嵃娆℃暟 + public Int64 HEquipID; //璁惧涓绘。(Gy_EquipFileBillMain) + public Int64 HOrgID; //浣跨敤缁勭粐(Xt_ORGANIZATIONS) + public Int64 HDeptID; //浣跨敤閮ㄩ棬(Gy_Deparment) + public Int64 HEmpID; //璐熻矗浜猴紙Gy_Employee锛� + } +} diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillSub.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillSub.cs" new file mode 100644 index 0000000..c90f96e --- /dev/null +++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsBillSub.cs" @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsSb_EquipSparepartsBillSub : DBUtility.ClsXt_BaseBillSub + { + public string HBillNo_bak; //鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級 + public Int64 HItemSubID; //鑷鍒�(GUID) + public Int64 HMaterID; //鍣ㄥ叿(Gy_MouldFileMain) + public decimal HQty; //鏁伴噺 + public string HPartAddr; //閮ㄤ綅 + public Int64 HSNFlag; //SN鐮佺鎺� + public DateTime HBeginDate; //寮�濮嬫椂闂� + public DateTime HEndDate; //鏈夋晥鏈熻嚦 + } +} diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillMain.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillMain.cs" new file mode 100644 index 0000000..f2e9f65 --- /dev/null +++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillMain.cs" @@ -0,0 +1,15 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsSb_EquipSparepartsChangeBillMain : DBUtility.ClsXt_BaseBillMain + { + public Int64 HPrintQty; //鎵撳嵃娆℃暟 + public Int64 HEquipID; //璁惧涓绘。(Gy_EquipFileBillMain) + public Int64 HOrgID; //浣跨敤缁勭粐(Xt_ORGANIZATIONS) + public Int64 HDeptID; //浣跨敤閮ㄩ棬(Gy_Deparment) + public Int64 HEmpID; //璐熻矗浜猴紙Gy_Employee锛� + } +} diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillSub.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillSub.cs" new file mode 100644 index 0000000..9097280 --- /dev/null +++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipSparepartsChangeBillSub.cs" @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsSb_EquipSparepartsChangeBillSub : DBUtility.ClsXt_BaseBillSub + { + public string HBillNo_bak; //鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級 + public Int64 HItemSubID; //鑷鍒�(GUID) + public Int64 HMaterID_Old; //鍘熷櫒鍏�(Gy_MouldFileMain) + public Int64 HMaterID_New; //鏂板櫒鍏�(Gy_MouldFileMain) + public decimal HQty; //鏁伴噺 + public string HPartAddr; //閮ㄤ綅 + public Int64 HSNFlag; //SN鐮佺鎺� + public DateTime HBeginDate; //寮�濮嬫椂闂� + public DateTime HEndDate; //鏈夋晥鏈熻嚦 + } +} diff --git a/WebAPI/Controllers/SBGL/Sb_EquipSparepartsBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipSparepartsBillController.cs new file mode 100644 index 0000000..73d37cd --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipSparepartsBillController.cs @@ -0,0 +1,290 @@ +锘縰sing DBUtility; +using Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.SBGL +{ + public class Sb_EquipSparepartsBillController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region [璁惧澶囧搧澶囦欢鍒楄〃] + [Route("Sb_EquipSparepartsBill/list")] + [HttpGet] + public object list(string sWhere, string user) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sb_EquipSparepartsBillList order by HMainID asc", "h_v_Sb_EquipSparepartsBillList"); + } + else + { + string sql1 = "select * from h_v_Sb_EquipSparepartsBillList where 1 = 1 "; + string sql = sql1 + sWhere + " order by HMainID asc"; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipSparepartsBillList"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region [鏍规嵁ID鏌ユ壘璁板綍] + [Route("Sb_EquipSparepartsBill/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Sb_EquipSparepartsBillList where HMainID =" + HInterID, "h_v_Sb_EquipSparepartsBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧澶囧搧澶囦欢 淇濆瓨/缂栬緫鍔熻兘 + [Route("Sb_EquipSparepartsBill/EquipSparepartsBillEdit")] + [HttpPost] + public object EquipSparepartsBillEdit([FromBody] JObject sMainSub) + { + try + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + oCN.BeginTran(); + //淇濆瓨涓昏〃 + objJsonResult = AddBillMain(msg1); + if (objJsonResult.code == "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillMain(string msg1) + { + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁 + string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁 + int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); + + try + { + msg2 = "[" + msg2.ToString() + "]"; + List<ClsSb_EquipSparepartsBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipSparepartsBillMain>>(msg2); + + long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + long HBillStatus = 1;//鍗曟嵁鍙� + long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐 + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + string HRemark = mainList[0].HRemark;//澶囨敞 + long HEmpID = mainList[0].HEmpID;//鍙樻洿浜� + long HDeptID = mainList[0].HDeptID;//閮ㄩ棬 + long HEquipID = mainList[0].HEquipID;//璁惧涓绘。 + long HOrgID = mainList[0].HOrgID;//浣跨敤缁勭粐 + string HMaker = user;//鍒跺崟浜� + + DateTime dt = DateTime.Now; + + + + //ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList"); + + if ((OperationType == 1 || OperationType == 2))//鏂板 && ds.Tables[0].Rows.Count == 0 + { + //DataSet Ds; + //Int64 NewHInterID = 1; + //Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain"); + //if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0) + //{ + // NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()); + // NewHInterID += 1; + //} + //涓昏〃 + oCN.RunProc(@"Insert Into Sb_EquipSparepartsBillMain + (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus + ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID + ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HEmpID,HDeptID,HCheckItemNowID + ,HCheckItemNextID,HCheckFlowID,HBacker,HChecker,HUpDater,HCloseMan,HCloseType,HDeleteMan,HEquipID,HOrgID) + values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3980 + "','" + + mainList[0].HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + mainList[0].HRemark + + "','" + mainList[0].HBackRemark + "','" + mainList[0].HMaker + "','" + dt + "','" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID + + "," + mainList[0].HMainSourceEntryID + ",'" + mainList[0].HMainSourceBillNo + "'," + mainList[0].HPrintQty + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",0,0,0" + ",'" + mainList[0].HBacker + "','" + mainList[0].HChecker + "','" + mainList[0].HUpDater + "','" + mainList[0].HCloseMan + "'," + 0 + ",'" + mainList[0].HDeleteMan + "'," + HEquipID + "," + HOrgID + ")"); + } + else if (OperationType == 3)//|| ds.Tables[0].Rows.Count != 0 + { //淇敼 + oCN.RunProc("update Sb_EquipSparepartsBillMain set " + + "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + + ",HEmpID=" + HEmpID + ",HDeptID=" + HDeptID + ",HEquipID=" + HEquipID + + ",HOrgID=" + HOrgID + " where HInterID=" + HInterID); + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Sb_EquipSparepartsBillSub where HInterID='" + HInterID + "'"); + } + //淇濆瓨瀛愯〃 + objJsonResult = AddBillSub(msg3, HInterID, OperationType); + + if (objJsonResult.code == "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillSub(string msg3, long HInterID, int OperationType) + { + List<ClsSb_EquipSparepartsBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipSparepartsBillSub>>(msg3); + + + + int i = 0; + foreach (ClsSb_EquipSparepartsBillSub oSub in DetailColl) + { + i++; + + DataSet Cs; + Int64 NewHEntryID = 1; + Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Sb_EquipSparepartsBillSub", "Sb_EquipSparepartsBillSub"); + if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0) + { + NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()); + NewHEntryID += 1; + } + + oCN.RunProc($@"Insert into Sb_EquipSparepartsBillSub + (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty + ,HRelationMoney,HCloseMan,HCloseType,HItemSubID,HMaterID,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate) + values({HInterID},{NewHEntryID},'{oSub.HBillNo_bak}','{oSub.HRemark}',{oSub.HSourceInterID} + ,{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney},'{oSub.HCloseMan}',0,0,{oSub.HMaterID},{oSub.HQty},'{oSub.HPartAddr}', + {oSub.HSNFlag},'{oSub.HBeginDate}','{oSub.HEndDate}')"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + #endregion + + #region [鍒犻櫎] + [Route("Sb_EquipSparepartsBill/Delete")] + [HttpGet] + public object Delete(string HInterID, string user) + { + try + { + oCN.BeginTran(); + oCN.RunProc("Delete From Sb_EquipSparepartsBillMain where HInterID = " + HInterID); + oCN.RunProc("Delete From Sb_EquipSparepartsBillSub where HInterID = " + HInterID); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SBGL/Sb_EquipSparepartsChangeBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipSparepartsChangeBillController.cs new file mode 100644 index 0000000..0619b04 --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipSparepartsChangeBillController.cs @@ -0,0 +1,290 @@ +锘縰sing DBUtility; +using Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.SBGL +{ + public class Sb_EquipSparepartsChangeBillController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region [璁惧澶囧搧澶囦欢鍙樻洿鍒楄〃] + [Route("Sb_EquipSparepartsChangeBill/list")] + [HttpGet] + public object list(string sWhere, string user) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sb_EquipSparepartsChangeBillList order by HMainID asc", "h_v_Sb_EquipSparepartsChangeBillList"); + } + else + { + string sql1 = "select * from h_v_Sb_EquipSparepartsChangeBillList where 1 = 1 "; + string sql = sql1 + sWhere + " order by HMainID asc"; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipSparepartsChangeBillList"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region [鏍规嵁ID鏌ユ壘璁板綍] + [Route("Sb_EquipSparepartsChangeBill/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Sb_EquipSparepartsChangeBillList where HMainID =" + HInterID, "h_v_Sb_EquipSparepartsChangeBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧澶囧搧澶囦欢鍙樻洿 淇濆瓨/缂栬緫鍔熻兘 + [Route("Sb_EquipSparepartsChangeBill/EquipSparepartsChangeBillEdit")] + [HttpPost] + public object EquipSparepartsBillEdit([FromBody] JObject sMainSub) + { + try + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + oCN.BeginTran(); + //淇濆瓨涓昏〃 + objJsonResult = AddBillMain(msg1); + if (objJsonResult.code == "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillMain(string msg1) + { + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁 + string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁 + int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); + + try + { + msg2 = "[" + msg2.ToString() + "]"; + List<ClsSb_EquipSparepartsChangeBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipSparepartsChangeBillMain>>(msg2); + + long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + long HBillStatus = 1;//鍗曟嵁鍙� + long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐 + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + string HRemark = mainList[0].HRemark;//澶囨敞 + long HEmpID = mainList[0].HEmpID;//鍙樻洿浜� + long HDeptID = mainList[0].HDeptID;//閮ㄩ棬 + long HEquipID = mainList[0].HEquipID;//璁惧涓绘。 + long HOrgID = mainList[0].HOrgID;//浣跨敤缁勭粐 + string HMaker = user;//鍒跺崟浜� + + DateTime dt = DateTime.Now; + + + + //ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList"); + + if ((OperationType == 1 || OperationType == 2))//鏂板 && ds.Tables[0].Rows.Count == 0 + { + //DataSet Ds; + //Int64 NewHInterID = 1; + //Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain"); + //if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0) + //{ + // NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()); + // NewHInterID += 1; + //} + //涓昏〃 + oCN.RunProc(@"Insert Into Sb_EquipSparepartsChangeBillMain + (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus + ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID + ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HEmpID,HDeptID,HCheckItemNowID + ,HCheckItemNextID,HCheckFlowID,HBacker,HChecker,HUpDater,HCloseMan,HCloseType,HDeleteMan,HEquipID,HOrgID) + values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3981 + "','" + + mainList[0].HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + mainList[0].HRemark + + "','" + mainList[0].HBackRemark + "','" + mainList[0].HMaker + "','" + dt + "','" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID + + "," + mainList[0].HMainSourceEntryID + ",'" + mainList[0].HMainSourceBillNo + "'," + mainList[0].HPrintQty + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",0,0,0" + ",'" + mainList[0].HBacker + "','" + mainList[0].HChecker + "','" + mainList[0].HUpDater + "','" + mainList[0].HCloseMan + "'," + 0 + ",'" + mainList[0].HDeleteMan + "'," + HEquipID + "," + HOrgID + ")"); + } + else if (OperationType == 3)//|| ds.Tables[0].Rows.Count != 0 + { //淇敼 + oCN.RunProc("update Sb_EquipSparepartsChangeBillMain set " + + "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + + ",HEmpID=" + HEmpID + ",HDeptID=" + HDeptID + ",HEquipID=" + HEquipID + + ",HOrgID=" + HOrgID + " where HInterID=" + HInterID); + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Sb_EquipSparepartsChangeBillSub where HInterID='" + HInterID + "'"); + } + //淇濆瓨瀛愯〃 + objJsonResult = AddBillSub(msg3, HInterID, OperationType); + + if (objJsonResult.code == "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillSub(string msg3, long HInterID, int OperationType) + { + List<ClsSb_EquipSparepartsChangeBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipSparepartsChangeBillSub>>(msg3); + + + + int i = 0; + foreach (ClsSb_EquipSparepartsChangeBillSub oSub in DetailColl) + { + i++; + + DataSet Cs; + Int64 NewHEntryID = 1; + Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Sb_EquipSparepartsChangeBillSub", "Sb_EquipSparepartsChangeBillSub"); + if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0) + { + NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()); + NewHEntryID += 1; + } + + oCN.RunProc($@"Insert into Sb_EquipSparepartsChangeBillSub + (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty + ,HRelationMoney,HCloseMan,HCloseType,HItemSubID,HMaterID_Old,HMaterID_New,HQty,HPartAddr,HSNFlag,HBeginDate,HEndDate) + values({HInterID},{NewHEntryID},'{oSub.HBillNo_bak}','{oSub.HRemark}',{oSub.HSourceInterID} + ,{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney},'{oSub.HCloseMan}',0,0,{oSub.HMaterID_Old},{oSub.HMaterID_New},{oSub.HQty},'{oSub.HPartAddr}', + {oSub.HSNFlag},'{oSub.HBeginDate}','{oSub.HEndDate}')"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + #endregion + + #region [鍒犻櫎] + [Route("Sb_EquipSparepartsChangeBill/Delete")] + [HttpGet] + public object Delete(string HInterID, string user) + { + try + { + oCN.BeginTran(); + oCN.RunProc("Delete From Sb_EquipSparepartsChangeBillMain where HInterID = " + HInterID); + oCN.RunProc("Delete From Sb_EquipSparepartsChangeBillSub where HInterID = " + HInterID); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index d5525cd..2f17948 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -2788,6 +2788,124 @@ } /// <summary> + /// 鑾峰彇璁惧涓绘。鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetGy_EquipFileBillMainList_Json")] + [HttpGet] + public object GetGy_EquipFileBillMainList_Json(string EquipFileBill) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (EquipFileBill != "") + { + sWhere = sWhere + " and ( HEquipFileNumber like '%" + EquipFileBill + "%' or HName like '%" + EquipFileBill + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain"); + } + else + { + string sql1 = "Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_EquipFileBillMain"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇鍣ㄥ叿鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetGy_MouldFileMainList_Json")] + [HttpGet] + public object GetGy_MouldFileMainList_Json(string MouldFileMain) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (MouldFileMain != "") + { + sWhere = sWhere + " and ( HNumber like '%" + MouldFileMain + "%' or HName like '%" + MouldFileMain + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HInterID,HNumber,HName from Gy_MouldFileMain where 0=0 Order by HInterID ", "Gy_MouldFileMain"); + } + else + { + string sql1 = "Select HInterID,HNumber,HName from Gy_MouldFileMain where 0=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_MouldFileMain"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> /// 鑾峰彇鐐规椤圭洰鍒楄〃 /// </summary> /// <returns></returns> diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/KF_BarCodeStatusChangeBillController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/KF_BarCodeStatusChangeBillController.cs" new file mode 100644 index 0000000..c6343bc --- /dev/null +++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/KF_BarCodeStatusChangeBillController.cs" @@ -0,0 +1,285 @@ +锘縰sing DBUtility; +using Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.浠撳瓨绠$悊.鏉$爜鐢熸垚 +{ + public class KF_BarCodeStatusChangeBillController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region [鏉$爜鐘舵�佸彉鏇村崟鍒楄〃] + [Route("KF_BarCodeStatusChangeBill/list")] + [HttpGet] + public object list(string sWhere, string user) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_KF_BarCodeStatusChangeBillList order by HMainID asc", "h_v_KF_BarCodeStatusChangeBillList"); + } + else + { + string sql1 = "select * from h_v_KF_BarCodeStatusChangeBillList where 1 = 1 "; + string sql = sql1 + sWhere + " order by HMainID asc"; + ds = oCN.RunProcReturn(sql, "h_v_KF_BarCodeStatusChangeBillList"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region [鏍规嵁ID鏌ユ壘璁板綍] + [Route("KF_BarCodeStatusChangeBill/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_KF_BarCodeStatusChangeBillList where HMainID =" + HInterID, "h_v_KF_BarCodeStatusChangeBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鏉$爜鐘舵�佸彉鏇村崟 淇濆瓨/缂栬緫鍔熻兘 + [Route("KF_BarCodeStatusChangeBill/BarCodeStatusChangeBillEdit")] + [HttpPost] + public object BarCodeStatusChangeBillEdit([FromBody] JObject sMainSub) + { + try + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + oCN.BeginTran(); + //淇濆瓨涓昏〃 + objJsonResult = AddBillMain(msg1); + if (objJsonResult.code == "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillMain(string msg1) + { + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁 + string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁 + int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string user = sArray[3].ToString(); + + try + { + msg2 = "[" + msg2.ToString() + "]"; + List<ClsKF_BarCodeStatusChangeBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKF_BarCodeStatusChangeBillMain>>(msg2); + + long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + long HBillStatus = 1;//鍗曟嵁鍙� + long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐 + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + string HRemark = mainList[0].HRemark;//澶囨敞 + long HEmpID = mainList[0].HEmpID;//鍙樻洿浜� + long HDeptID = mainList[0].HDeptID;//閮ㄩ棬 + string HMaker = user;//鍒跺崟浜� + + DateTime dt = DateTime.Now; + + + + //ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList"); + + if ((OperationType == 1 || OperationType == 2))//鏂板 && ds.Tables[0].Rows.Count == 0 + { + //DataSet Ds; + //Int64 NewHInterID = 1; + //Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain"); + //if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0) + //{ + // NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()); + // NewHInterID += 1; + //} + //涓昏〃 + oCN.RunProc(@"Insert Into KF_BarCodeStatusChangeBillMain + (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus + ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID + ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HEmpID,HDeptID) + values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1288 + "','" + + mainList[0].HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + mainList[0].HRemark + + "','" + mainList[0].HBackRemark + "','" + mainList[0].HMaker + "','" + dt + "','" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID + + "," + mainList[0].HMainSourceEntryID + ",'" + mainList[0].HMainSourceBillNo + "'," + mainList[0].HPrintQty + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ")"); + } + else if (OperationType == 3)//|| ds.Tables[0].Rows.Count != 0 + { //淇敼 + oCN.RunProc("update KF_BarCodeStatusChangeBillMain set " + + "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + ",HBillStatus=" + HBillStatus + + ",HEmpID=" + HEmpID + ",HDeptID=" + HDeptID + " where HInterID=" + HInterID); + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from KF_BarCodeStatusChangeBillSub where HInterID='" + HInterID + "'"); + } + //淇濆瓨瀛愯〃 + objJsonResult = AddBillSub(msg3, HInterID, OperationType); + + if (objJsonResult.code == "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillSub(string msg3, long HInterID, int OperationType) + { + List<ClsKF_BarCodeStatusChangeBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKF_BarCodeStatusChangeBillSub>>(msg3); + + + + int i = 0; + foreach (ClsKF_BarCodeStatusChangeBillSub oSub in DetailColl) + { + i++; + + DataSet Cs; + Int64 NewHEntryID = 1; + Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from KF_BarCodeStatusChangeBillSub", "KF_BarCodeStatusChangeBillSub"); + if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0) + { + NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()); + NewHEntryID += 1; + } + + oCN.RunProc($@"Insert into KF_BarCodeStatusChangeBillSub + (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty + ,HRelationMoney,HBarCode,HBarCodeStatus_Old,HBarCodeStatus_New,HAuxPropID_Old,HAuxPropID_New,HMTONo_Old,HMTONo_New) + values({HInterID},{NewHEntryID},'{oSub.HBillNo_bak}','{oSub.HRemark}',{oSub.HSourceInterID} + ,{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney},'{oSub.HBarCode}','{oSub.HBarCodeStatus_Old}','{oSub.HBarCodeStatus_New}','{oSub.HAuxPropID_Old}','{oSub.HAuxPropID_New}','{oSub.HMTONo_Old}','{oSub.HMTONo_New}')"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + #endregion + + #region [鍒犻櫎] + [Route("KF_BarCodeStatusChangeBill/Delete")] + [HttpGet] + public object Delete(string HInterID,string user) + { + try + { + oCN.BeginTran(); + oCN.RunProc("Delete From KF_BarCodeStatusChangeBillMain where HInterID = " + HInterID); + oCN.RunProc("Delete From KF_BarCodeStatusChangeBillSub where HInterID = " + HInterID); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 7ea71e5..69fa63b 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -393,6 +393,8 @@ <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" /> <Compile Include="Controllers\Gy_MateMouldController.cs" /> <Compile Include="Controllers\Pay_ReportController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipSparepartsBillController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" /> <Compile Include="Controllers\SCGL\Sc_ComplementGoodBill_ZXBZController.cs" /> <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱DataHelper.cs" /> <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱JIT_Cg_PODemandPlanBillController.cs" /> @@ -438,6 +440,7 @@ <Compile Include="Controllers\浠撳瓨绠$悊\鎵爜寮傚父璁板綍\KF_PonderationBillController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\鏉$爜鍑哄叆搴撹褰昞Kf_ICStockInOutBillController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\鏉$爜搴撳瓨\KF_ICInventoryList_WMSBillController.cs" /> + <Compile Include="Controllers\浠撳瓨绠$悊\鏉$爜鐢熸垚\KF_BarCodeStatusChangeBillController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\鏉$爜鐢熸垚\Sc_BarCodeController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\璋冩嫧鐩樼偣\Kf_MoveStockRequestBillController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\棰嗘枡鍙戣揣\apiController.cs" /> @@ -919,6 +922,7 @@ <Folder Include="Views\JIT_DayPlanPlatFormBill\" /> <Folder Include="Views\JIT_DayPlanPlatFormImport\" /> <Folder Include="Views\JIT_ICMOSortBillList\" /> + <Folder Include="Views\KF_BarCodeStatusChangeBill\" /> <Folder Include="Views\KF_ICInventoryList_WMSBill\" /> <Folder Include="Views\Kf_ICStockBillMain\" /> <Folder Include="Views\Kf_ICStockInOutBill\" /> @@ -934,6 +938,8 @@ <Folder Include="Views\ProductionReturnBill\" /> <Folder Include="Views\QC_Management\" /> <Folder Include="Views\Sb_EquipRepairSendWorkBill\" /> + <Folder Include="Views\Sb_EquipSparepartsBill\" /> + <Folder Include="Views\Sb_EquipSparepartsChangeBill\" /> <Folder Include="Views\Sc_CallGoodsBackRequestBill\" /> <Folder Include="Views\Sc_ComplementGoodBill\" /> <Folder Include="Views\Sc_ComplementGoodBill_ZXBZ\" /> -- Gitblit v1.9.1