| | |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using System.Web.Http; |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | |
| | | namespace WebAPI.Controllers |
| | |
| | | values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)} |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},4 |
| | | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},'{oSub.HSTATUS}' |
| | | ,0,0,'','',0,0 |
| | | ,{oSub.HCOSTRATE},{oSub.HISBACKFLUSH},'{oSub.HBatchNo}',{oSub.HBomID},{oSub.HCHECKPRODUCT},{oSub.HSEQ},{oSub.HSTOCKINORGID})"); |
| | | } |
| | |
| | | int OperationType = int.Parse(sArray[1].ToString()); // æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ |
| | | string user = sArray[2].ToString(); |
| | | int HEntryID = int.Parse(sArray[3].ToString()); |
| | | string HComputerName = SystemInformation.ComputerName; //设å¤åç§° |
| | | |
| | | try |
| | | { |
| | |
| | | string HMaker = user;//å¶å人 |
| | | string HIsStockQty = mainList[0].HIsStockQty; |
| | | string HRemark3 = mainList[0].HRemark3; |
| | | |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_IF_ICMOBillList"); |
| | | |
| | | if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_ICMOBillMain |
| | |
| | | ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID + |
| | | "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" + |
| | | ",'"+ HIsStockQty + "','"+ HRemark3 + "') "); |
| | | |
| | | |
| | | |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",æ°å¢ç产订ååæ®:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "æ°å¢ç产订ååæ®ï¼" + HBillNo + "','LMES-çäº§è®¢åæ¨¡å','" + DBUtility.ClsPub.IPAddress + "','æ°å¢åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | |
| | | oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'"); |
| | | |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",ä¿®æ¹ç产订ååæ®:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "ä¿®æ¹ç产订ååæ®ï¼" + HBillNo + "','LMES-çäº§è®¢åæ¨¡å','" + DBUtility.ClsPub.IPAddress + "','ä¿®æ¹åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID); |
| | | |
| | | |
| | | //ååæºå-éå®è®¢åæ°æ® |
| | | if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //çäº§è®¢åæ°å¢åå¡«éå®è®¢åå
³èæ°é |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID); |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | //ç产订åå é¤åå¡«éå®è®¢åå
³èæ°é |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID); |
| | | //çäº§è®¢åæ°å¢åå¡«éå®è®¢åå
³èæ°é |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID); |
| | | } |
| | | |
| | | |
| | | |
| | | if (objJsonResult.code == "0") |
| | | { |
| | |
| | | ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS |
| | | ,HBomID,HEntryCusID,HSTOCKINORGID |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney |
| | | ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark) |
| | | ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel,HOrderPickRemark) |
| | | values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)} |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}' |
| | | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS} |
| | | ,{oSub.HBomID} ,{oSub.HCusID} ,{oSub.HSTOCKINORGID} |
| | | ,0,0,'','',0,0 |
| | | ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}')"); |
| | | |
| | | ,{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',0,0 |
| | | ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}','{oSub.HOrderPickRemark}')"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | { |
| | | try |
| | | { |
| | | string HComputerName = SystemInformation.ComputerName; //设å¤åç§° |
| | | |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Drop", 1, false, user)) |
| | | { |
| | |
| | | return objJsonResult; ; |
| | | } |
| | | |
| | | //ç产订åå é¤åå¡«éå®è®¢åå
³èæ°é |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID); |
| | | |
| | | |
| | | oCN.RunProc("delete from Sc_ICMOBillMain where HInterID=" + HInterID); |
| | | oCN.RunProc("delete from Sc_ICMOBillSub where HInterID=" + HInterID); |
| | | |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",å é¤ç产订ååæ®:" + ds.Tables[0].Rows[0]["HBillNo"].ToString()); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "å é¤ç产订ååæ®ï¼" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-çäº§è®¢åæ¨¡å','" + DBUtility.ClsPub.IPAddress + "','å é¤åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | oCN.Commit();//æäº¤äºå¡ |
| | | objJsonResult.code = "0"; |
| | |
| | | #region ç产任å¡åè·åè½¦é´ |
| | | [Route("Sc_ICMOBill/GetHDeptList")] |
| | | [HttpGet] |
| | | public object GetHDeptList() |
| | | public object GetHDeptList(string HOrgID) |
| | | { |
| | | try |
| | | { |
| | | DataSet oDs = new DataSet(); |
| | | //========== |
| | | oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department", "Gy_Department"); |
| | | oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department where HUSEORGID="+ HOrgID, "Gy_Department"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è·åæåï¼"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region ç产任å¡å订åå
è£
夿³¨ ä¿ååè½ |
| | | [Route("Sc_ICMOBill/ICMOBillSaveRemark")] |
| | | [HttpGet] |
| | | public object ICMOBillSaveRemark(string HInterID,string HEntryID, string HOrderPickRemark) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼HInterIDä¸è½ä¸ºç©º"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | oCN.BeginTran(); |
| | | oCN.RunProc("update Sc_ICMOBillSub set HOrderPickRemark = '" + HOrderPickRemark + "' where HInterID = " + HInterID + " and HEntryID = " + HEntryID + ""); |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 为è¿è¡æäº§çç产订å å表 |
| | | [Route("Sc_ICMOBill/NotInDayPlan")] |
| | | [HttpGet] |
| | | public object Sc_ICMOBillList_NotInDayPlan(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOList_NotInDayPlan where 1 = 1" + sWhere , "h_v_Sc_ICMOList_NotInDayPlan"); |
| | | |
| | | if (ds == null && ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Sucessï¼æ²¡ææ¥è¯¢å°ç¸å
³æ°æ®"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | //æ·»å åå |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |