File was renamed from WebAPI/Controllers/SCGL/QC_ProcessCheckBillController.cs |
| | |
| | | namespace WebAPI.Controllers |
| | | { |
| | | //å·¥åºæ£éªåController |
| | | //æ°æ®åºä¸»è¡¨QC_ProcessCheckBillMain |
| | | //æ°æ®åºå表QC_ProcessCheckBillSub |
| | | public class QC_ProcessCheckBillController : ApiController |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | SQLHelper.ClsCN oCN1 = new SQLHelper.ClsCN(); |
| | | DataSet ds1; |
| | | |
| | | |
| | | |
| | | #region å·¥åºæ£éªåä¿å |
| | | /// <summary> |
| | | /// æ°å¢åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | | ///è¿åå¼ï¼objectã |
| | | /// </summary> |
| | | [Route("QC_ProcessCheckBill/AddBill")] |
| | | [Route("QC_ProcessCheckBill/set_SaveBill")] |
| | | [HttpPost] |
| | | public object AddBill([FromBody] JObject sMainSub) |
| | | public object set_SaveBill([FromBody] JObject sMainSub) |
| | | { |
| | | 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 = "æ°å¢åæ®æåï¼"; |
| | | return objJsonResult; |
| | | //ä¿ååæ® |
| | | return objJsonResult = AddBillMain(msg1); |
| | | } |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string OperationType = sArray[2].ToString().Trim(); |
| | | bool bResult; |
| | | try |
| | | { |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<QC_ProcessCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<QC_ProcessCheckBillMain>>(msg2); |
| | | string BillType = "7507"; |
| | | long HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | string HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | List<Model.ClsQC_ProcessCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_ProcessCheckBillMain>>(msg2); |
| | | DAL.ClsQC_ProcessCheckBill BillNew = new DAL.ClsQC_ProcessCheckBill(); |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = mainList[0].HDate;//æ¥æ |
| | | int HYear = 2021; |
| | | double HPeriod = 1; |
| | | long HBillStatus = mainList[0].HBillStatus; |
| | | long HCheckItemNowID = mainList[0].HCheckItemNowID; |
| | | long HCkeckItemNextID = mainList[0].HCheckItemNextID; |
| | | long HCheckFlowID = mainList[0].HCheckFlowID; |
| | | string HRemark = mainList[0].HRemark;//夿³¨ |
| | | string HBacker = mainList[0].HBacker; |
| | | DateTime HBackDate = mainList[0].HBackDate; |
| | | string HBackRemark = mainList[0].HBackRemark; |
| | | string HChecker = mainList[0].HChecker; |
| | | DateTime HCheckDate = mainList[0].HCheckDate; |
| | | string HMaker = mainList[0].HMaker; |
| | | DateTime HMakeDate = mainList[0].HMakeDate; |
| | | string HUpDater = mainList[0].HUpDater; |
| | | DateTime HUpDateDate = mainList[0].HUpDateDate; |
| | | string HCloseMan = mainList[0].HCloseMan; |
| | | DateTime HCloseDate = mainList[0].HCloseDate; |
| | | string HCloseType = mainList[0].HCloseType; |
| | | string HDeleteMan = mainList[0].HDeleteMan; |
| | | DateTime HDeleteDate = mainList[0].HDeleteDate; |
| | | string HMainSourceBillType = mainList[0].HMainSourceBillType; |
| | | long HMainSourceInterID = mainList[0].HMainSourceInterID; |
| | | long HMainSourceEntryID = mainList[0].HMainSourceEntryID; |
| | | string HMainSourceBillNo = mainList[0].HMainSourceBillNo; |
| | | double HPrintQty = mainList[0].HPrintQty; |
| | | long HICMOInterID = mainList[0].HICMOInterID; |
| | | string HICMOBillNo = mainList[0].HICMOBillNo; |
| | | long HProExchInterID = mainList[0].HProcExchInterID; |
| | | long HProExchEntryID = mainList[0].HProcExchEntryID; |
| | | string HProExchBillNo = mainList[0].HProcExchBillNo; |
| | | long HMaterID = mainList[0].HMaterID; |
| | | long HProcID = mainList[0].HProcID; |
| | | long HSourceID = mainList[0].HSourceID; |
| | | long HEmpID = mainList[0].HEmpID; |
| | | double HInStockQty = mainList[0].HInStockQty; |
| | | double HCheckQty = mainList[0].HCheckQty; |
| | | double HRightQty = mainList[0].HRightQty; |
| | | double HBadQty = mainList[0].HBadQty; |
| | | long HFirstCheckEmp = mainList[0].HFirstCheckEmp; |
| | | string HCheckerResult = mainList[0].HCheckerResult; |
| | | string HBarcode = mainList[0].HBarcode; |
| | | string HLBatchNo = mainList[0].HLBatchNo; |
| | | long HCusID = mainList[0].HCusID; |
| | | string HSortBillNo = mainList[0].HSortBillNo; |
| | | string HConTrctBatchNo = mainList[0].HContrctBatchNo; |
| | | long HProdAreaID = mainList[0].HProdAreaID; |
| | | long HProdTypeID = mainList[0].HProdTypeID; |
| | | string HProdStoveNo = mainList[0].HProdStoveNo; |
| | | long HRecipeID = mainList[0].HRecipeID; |
| | | double HDiameter1 = mainList[0].HDiameter1; |
| | | double HDiameter2 = mainList[0].HDiameter2; |
| | | long HRoutingInterID = mainList[0].HRoutingInterID; |
| | | long HPackTypeID = mainList[0].HPackTypeID; |
| | | long HDrawingDireID = mainList[0].HDrawingDireID; |
| | | |
| | | //主表 |
| | | oCN.RunProc("Insert Into QC_ProcessCheckBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HRemark" + |
| | | ",HICMOInterID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + |
| | | ",HMaterID,HProcID,HSourceID,HEmpID,HInStockQty" + |
| | | ",HCheckQty,HRightQty,HBadQty,HFirstCheckEmp,HCheckerResult" + |
| | | ",HBarCode,HLBatchNo,HCusID,HSortBillNo,HContrctBatchNo" + |
| | | ",HProdAreaID,HProdTypeID,HProdStoveNo,HRecipeID,HDiameter1" + |
| | | ",HDiameter2,HRoutingInterID,HDrawingDireID,HPackTypeID" + |
| | | ") " + |
| | | " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HBillStatus + "','" + HDate + "','" + HMaker + "','" + HDate + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "'" + |
| | | "," + HICMOInterID + "," + HICMOBillNo + "," + HProExchInterID + "," + HProExchEntryID + ",'" + HProExchBillNo + "'" + |
| | | "," + HMaterID + "," + HProcID + "," + HSourceID + "," + HEmpID + "," + HInStockQty + |
| | | "," + HCheckQty + "," + HRightQty + "," + HBadQty + "," + HFirstCheckEmp + ",'" + HCheckerResult + "'" + |
| | | ",'" + HBarcode + "','" + HLBatchNo + "'," + HCusID + ",'" + HSortBillNo + "','" + HConTrctBatchNo + "'" + |
| | | "," + HProdAreaID + "," + HProdTypeID + ",'" + HProdStoveNo + "'," + HRecipeID + ",'" + HDiameter1 + "'" + |
| | | "," + HDiameter2 + "," + HRoutingInterID + "," + HDrawingDireID + "," + HPackTypeID + |
| | | ") "); |
| | | |
| | | |
| | | //å表 |
| | | oCN.RunProc("Insert into QC_ProcessCheckBillSub " + |
| | | " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | | ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + |
| | | ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue,HResult" + |
| | | ",HProcCheckEmp,HProcCheckTime" + |
| | | ") " + |
| | | " values('" + HInterID + "','',0,'" + HCloseMan + "'" + |
| | | ",'','','',0 " + |
| | | ",0,'','',0,0" + |
| | | ",0,0,'','',''"+ |
| | | ",0,''" + |
| | | ") "); |
| | | if (objJsonResult.code == "0") |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | BillNew.omodel.HYear = sYear; |
| | | BillNew.omodel.HPeriod = sPeriod; |
| | | //åºå®èµå¼================================= |
| | | BillNew.omodel.HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | BillNew.omodel.HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | BillNew.omodel.HDate = HDate; |
| | | BillNew.omodel.HRemark = mainList[0].HRemark;//夿³¨ |
| | | BillNew.omodel.HMaker = mainList[0].HMaker; |
| | | BillNew.omodel.HSourceID = ClsPub.isLong(mainList[0].HSourceID); |
| | | BillNew.omodel.HICMOInterID = ClsPub.isLong(mainList[0].HICMOInterID); |
| | | BillNew.omodel.HICMOBillNo = ClsPub.isStrNull(mainList[0].HICMOBillNo); |
| | | BillNew.omodel.HICMOInterID = ClsPub.isLong(mainList[0].HICMOInterID); |
| | | BillNew.omodel.HProcExchInterID = ClsPub.isLong(mainList[0].HProcExchInterID); |
| | | BillNew.omodel.HProcExchEntryID = ClsPub.isLong(mainList[0].HProcExchEntryID); |
| | | BillNew.omodel.HProcExchBillNo = ClsPub.isStrNull(mainList[0].HProcExchBillNo); |
| | | BillNew.omodel.HMaterID = ClsPub.isLong(mainList[0].HMaterID); |
| | | BillNew.omodel.HFirstCheckEmp = ClsPub.isLong(mainList[0].HFirstCheckEmp); |
| | | BillNew.omodel.HCheckerResult = ClsPub.isStrNull(mainList[0].HCheckerResult); |
| | | BillNew.omodel.HMainSourceInterID = ClsPub.isLong(mainList[0].HMainSourceInterID); |
| | | BillNew.omodel.HMainSourceEntryID = ClsPub.isLong(mainList[0].HMainSourceEntryID); |
| | | BillNew.omodel.HMainSourceBillNo = ClsPub.isStrNull(mainList[0].HMainSourceBillNo); |
| | | BillNew.omodel.HMainSourceBillType = ClsPub.isStrNull(mainList[0].HMainSourceBillType); |
| | | BillNew.omodel.HBillStatus = 1; |
| | | BillNew.omodel.HProcID = ClsPub.isLong(mainList[0].HProcID); |
| | | List<Model.ClsQC_ProcessCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_ProcessCheckBillSub>>(msg3); |
| | | BillNew.DetailColl = new List<Model.ClsQC_ProcessCheckBillSub>(); |
| | | for (int i = 0; i < subList.ToArray().Length; i++) |
| | | { |
| | | if (i >= 0)//HQty |
| | | { |
| | | Model.ClsQC_ProcessCheckBillSub oSub = new Model.ClsQC_ProcessCheckBillSub(); |
| | | oSub.HEntryID = i+1; |
| | | oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark); |
| | | oSub.HSourceInterID = ClsPub.isLong(subList[i].HSourceInterID); |
| | | oSub.HSourceEntryID = ClsPub.isLong(subList[i].HSourceEntryID); |
| | | oSub.HSourceBillType = ClsPub.isStrNull(subList[i].HSourceBillType); |
| | | oSub.HSourceBillNo = ClsPub.isStrNull(subList[i].HSourceBillNo); |
| | | oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[i].HRelationQty); |
| | | oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[i].HRelationMoney); |
| | | oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[i].HCloseMan); |
| | | oSub.HCloseType = DBUtility.ClsPub.isBool(subList[i].HCloseType); |
| | | oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(subList[i].HQCCheckItemID); |
| | | oSub.HQCStd = DBUtility.ClsPub.isStrNull(subList[i].HQCStd); |
| | | oSub.HResult = DBUtility.ClsPub.isStrNull(subList[i].HResult); |
| | | oSub.HQCRelValue = DBUtility.ClsPub.isStrNull(subList[i].HQCRelValue); |
| | | oSub.HProcCheckTime = HDate; |
| | | oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo); |
| | | oSub.HProcCheckEmp = ClsPub.isLong(mainList[0].HFirstCheckEmp); |
| | | |
| | | BillNew.DetailColl.Add(oSub); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æç»è¡ä¿¡æ¯!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //ä¿å宿¯åå¤ç |
| | | if (OperationType.Equals("1") || OperationType.Equals("2")) |
| | | { |
| | | bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo); |
| | | } |
| | | //æç¤º |
| | | if (bResult == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | //objJsonResult.Message = "åæ®åç宿¯!åæ®å·:" + mainList[0].HBillNo.Trim(); |
| | | objJsonResult.Message = ClsPub.sExeReturnInfo+"åæ®å·:" + mainList[0].HBillNo.Trim(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region å·¥åºæ£éªåOld |
| | | /// <summary> |
| | | /// å·¥åºæ£éªååè¡¨ä¿®æ¹æé®æ¹æ³ |
| | | ///åæ°ï¼string sqlã |
| | |
| | | long HPackTypeID = mainList[0].HPackTypeID; |
| | | long HDrawingDireID = mainList[0].HDrawingDireID; |
| | | |
| | | |
| | | |
| | | |
| | | //è¥MAINDIéå¤åéæ°è·å |
| | | oCN.BeginTran(); |
| | |
| | | [HttpGet] |
| | | public object Delete_Json(long HItemID) |
| | | { |
| | | DAL.ClsQC_ProcessCheckBill BillOld = new DAL.ClsQC_ProcessCheckBill(); |
| | | DAL.ClsQC_ProcessCheckBill BillOld = new DAL.ClsQC_ProcessCheckBill(); |
| | | try |
| | | { |
| | | if (BillOld.DeleteBill(HItemID, ref ClsPub.sExeReturnInfo) != true) |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | // |
| | | } |
| | | } |