| | |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //ç¼è¾æé |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList where 1 = 1 "); |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList_Sec where 1 = 1 "); |
| | | |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_MatePriceSupList"); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region éè´ä»·æ ¼ ç¼è¾æ¥çä¿¡æ¯ |
| | | [Route("Gy_MatePriceSup/cx")] |
| | | [HttpGet] |
| | | public object cx(string HItemID, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupEdit where HItemID = " + HItemID); |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "h_v_Gy_MatePriceSupEdit"); |
| | | |
| | | |
| | | 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("Gy_MatePriceSup/MatePriceSupEdit")] |
| | | [HttpPost] |
| | |
| | | string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg1 = sArray[0].ToString(); |
| | | string msg2 = sArray[1].ToString(); |
| | | //string msg_HUSEORGID = sArray[2].ToString(); |
| | | Int64 HItemID = 0; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | //ç¼è¾æé |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Edit", 1, false, msg2)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //è·åæå¤§IDå¼èµå¼ |
| | | //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate"); |
| | |
| | | } |
| | | else |
| | | { |
| | | //æ¯å¦å·²ç»å®¡æ ¸å¤æ |
| | | DataSet Maxds = oCN.RunProcReturn("select * from h_v_Gy_MatePriceSupEdit where HItemID = " + oBill.oModel.HItemID, "h_v_Gy_MatePriceSupEdit"); |
| | | if (Maxds != null && Maxds.Tables[0].Rows[0]["å®¡æ ¸äºº"].ToString()!="") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸æ æ³ç¼è¾ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | bResult = oBill.ModifyByID(oBill.oModel.HItemID); |
| | | } |
| | | if (bResult) |
| | |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //å 餿é |
| | | //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ å 餿é"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_MatePriceSupList_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿é"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (string.IsNullOrWhiteSpace(HItemID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; ; |
| | | } |
| | | //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); |
| | | //if (HStopflag) |
| | | //{ |
| | | // oCN.RollBack();//åæ»äºå¡ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ°æ®å·²ç¦ç¨æ æ³å é¤ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString()!="") |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ°æ®å·²å®¡æ ¸æ æ³å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("delete from Gy_MatePriceSup where HItemID=" + HItemID); |
| | | oCN.Commit();//æäº¤äºå¡ |
| | |
| | | try |
| | | { |
| | | var _value = msg["model"].ToString(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | LogService.Write("éè´ä»·æ ¼" + _value); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ListModels oListModels = new ListModels(); |
| | | List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>(); |
| | | lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(_value); |
| | | string sql = string.Empty; |
| | | //ä¿å |
| | | oCN.BeginTran(); |
| | | sql = $"delete Gy_MatePriceSup where HItemID = {lsmain[0].HItemID}"; |
| | | oCN.RunProc(sql); |
| | | sql = "set identity_insert Gy_MatePriceSup on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType |
| | | foreach (var item in lsmain) |
| | | { |
| | | sql = $"delete Gy_MatePriceSup where HItemID = {item.HItemID}"; |
| | | oCN.RunProc(sql); |
| | | sql = "set identity_insert Gy_MatePriceSup on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | |
| | | LogService.Write("éè´ä»·æ ¼" + $@" insert into Gy_MatePriceSup(HItemID,HNumber,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType |
| | | ,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) |
| | | values({lsmain[0].HItemID},{lsmain[0].HInterID},{lsmain[0].HEntryID},{lsmain[0].HMaterID},{lsmain[0].HRelationID},{lsmain[0].HUnitID},{lsmain[0].HBeginQty},{lsmain[0].HEndQty},{lsmain[0].HCurID},'{lsmain[0].HType}',{lsmain[0].HPrice},'{lsmain[0].HBeginDate}','{lsmain[0].HEndDate}','{lsmain[0].HUsed}','{lsmain[0].HRemark}','{lsmain[0].HMaker}','{lsmain[0].HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç |
| | | sql = "set identity_insert Gy_MatePriceSup off"; |
| | | oCN.RunProc(sql); |
| | | values({item.HItemID},'{item.HNumber}',{item.HInterID},{item.HEntryID},{item.HMaterID},{item.HRelationID},{item.HUnitID},{item.HBeginQty},{item.HEndQty},{item.HCurID},'{item.HType}',{item.HPrice},'{item.HBeginDate}','{item.HEndDate}','{item.HUsed}','{item.HRemark}','{item.HMaker}','{item.HMakeDate}')"); |
| | | |
| | | |
| | | oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HNumber,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType |
| | | ,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) |
| | | values({item.HItemID},'{item.HNumber}',{item.HInterID},{item.HEntryID},{item.HMaterID},{item.HRelationID},{item.HUnitID},{item.HBeginQty},{item.HEndQty},{item.HCurID},'{item.HType}',{item.HPrice},'{item.HBeginDate}','{item.HEndDate}','{item.HUsed}','{item.HRemark}','{item.HMaker}','{item.HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç |
| | | sql = "set identity_insert Gy_MatePriceSup off"; |
| | | oCN.RunProc(sql); |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å®¡æ ¸ãåå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="CurUserName">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Gy_MatePriceSup/CheckGy_MatePriceSup")] |
| | | [HttpGet] |
| | | public object CheckGy_MatePriceSup(long HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | try |
| | | { |
| | | //å®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Check", 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼æ æéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | var ds = oCN.RunProcReturn("select * from Gy_MatePriceSup where HItemID=" + HInterID, "Gy_MatePriceSup"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (IsAudit == 0) //å®¡æ ¸å¤æ |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸å¤æ |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | if (IsAudit == 0) //å®¡æ ¸å¤æ |
| | | { |
| | | oCN.RunProc("update Gy_MatePriceSup set HChecker='" + CurUserName + "',HCheckDate=getdate() where HItemID=" + HInterID); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸å¤æ |
| | | { |
| | | oCN.RunProc("update Gy_MatePriceSup set HChecker='',HCheckDate=null where HItemID=" + HInterID); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åå®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | oCN.Commit(); |
| | | |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥æè
åå®¡æ ¸å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¹éå®¡æ ¸ |
| | | /// <summary> |
| | | /// æ¹éå®¡æ ¸ |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="Type">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="HMaker">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Gy_MatePriceSup/CheckAll")] |
| | | [HttpGet] |
| | | public object CheckAll(string ids, int Type, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //å¤çå符串 |
| | | if (!string.IsNullOrEmpty(ids)) |
| | | { |
| | | long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse); |
| | | // å¤çidArray... |
| | | for (int i = 0; i < idArray.Length; i++) |
| | | { |
| | | objJsonResult = (json)CheckGy_MatePriceSup(idArray[i], Type, HMaker);//å®¡æ ¸æ§è¡ |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | |
| | | objJsonResult.Message += "第" + (i + 1) + "è¡åºç°é®é¢æ æ³ç»§ç»å®æ"; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¯·éæ©æ£ç¡®è¡"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region éè´ä»·ç® éè¶åæ¥ |
| | | [Route("Gy_MatePriceSup/SaveGy_PurPriceApi")] |
| | | [HttpPost] |
| | | public object SaveGy_PurPriceApi([FromBody] JObject msg) |
| | | { |
| | | try |
| | | { |
| | | var _value = msg["model"].ToString(); |
| | | LogService.Write("éè´ä»·ç®" + _value); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ListModels oListModels = new ListModels(); |
| | | List<Model.ClsGy_PurPrice_Model> lsmain = new List<Model.ClsGy_PurPrice_Model>(); |
| | | lsmain = oListModels.getObjectByJson_Gy_PurPrice(_value); |
| | | string sql = string.Empty; |
| | | //ä¿å |
| | | oCN.BeginTran(); |
| | | |
| | | foreach (var item in lsmain) |
| | | { |
| | | sql = $"delete Gy_PurPriceList where HItemID = {item.HItemID}"; |
| | | oCN.RunProc(sql); |
| | | sql = "set identity_insert Gy_PurPriceList on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | LogService.Write("éè´ä»·ç®" + $@" insert into Gy_PurPriceList(HItemID, HNumber, HName, HShortNumber, HParentID, HLevel, |
| | | HEndFlag, HStopflag, HRemark, HUseFlag, HCREATEORGID, HUSEORGID, |
| | | HMakeEmp, HMakeTime, HCheckEmp, HCheckTime,HModifyEmp, HModifyTime, HStopEmp, HStopTime, |
| | | HPURCHASEORGID, HSupID, HCurID, HPRICER, HPRICETYPE, HPRICEOBJECT,HISINCLUDEDTAX, HDEFPRICELISTID, HSUPPLIERMASTERID) |
| | | values({item.HItemID},'{item.HNumber}','{item.HName}','{item.HShortNumber}',{item.HParentID},{item.HLevel}, |
| | | '{item.HEndFlag}','{item.HStopflag}','{item.HRemark}','{item.HUseFlag}',{item.HCREATEORGID},{item.HUSEORGID}, |
| | | {item.HMakeEmp},'{item.HMakeTime}',{item.HCheckEmp},'{item.HCheckTime}',{item.HModifyEmp},'{item.HModifyTime}',{item.HStopEmp},'{item.HStopTime}', |
| | | {item.HPURCHASEORGID},{item.HSupID},{item.HCurID},{item.HPRICER},{item.HPRICETYPE},'{item.HPRICEOBJECT}','{item.HISINCLUDEDTAX}','{item.HDEFPRICELISTID}','{item.HSUPPLIERMASTERID}')"); |
| | | |
| | | oCN.RunProc($@"insert into Gy_PurPriceList(HItemID, HNumber, HName, HShortNumber, HParentID, HLevel, |
| | | HEndFlag, HStopflag, HRemark, HUseFlag, HCREATEORGID, HUSEORGID, |
| | | HMakeEmp, HMakeTime, HCheckEmp, HCheckTime,HModifyEmp, HModifyTime, HStopEmp, HStopTime, |
| | | HPURCHASEORGID, HSupID, HCurID, HPRICER, HPRICETYPE, HPRICEOBJECT,HISINCLUDEDTAX, HDEFPRICELISTID, HSUPPLIERMASTERID) |
| | | values({item.HItemID},'{item.HNumber}','{item.HName}','{item.HShortNumber}',{item.HParentID},{item.HLevel}, |
| | | '{item.HEndFlag}','{item.HStopflag}','{item.HRemark}','{item.HUseFlag}',{item.HCREATEORGID},{item.HUSEORGID}, |
| | | {item.HMakeEmp},'{item.HMakeTime}',{item.HCheckEmp},'{item.HCheckTime}',{item.HModifyEmp},'{item.HModifyTime}',{item.HStopEmp},'{item.HStopTime}', |
| | | {item.HPURCHASEORGID},{item.HSupID},{item.HCurID},{item.HPRICER},{item.HPRICETYPE},'{item.HPRICEOBJECT}','{item.HISINCLUDEDTAX}','{item.HDEFPRICELISTID}','{item.HSUPPLIERMASTERID}')", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç |
| | | sql = "set identity_insert Gy_PurPriceList off"; |
| | | oCN.RunProc(sql); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¿åæåï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |