|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | { //修改 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //修改 | 
|---|
|  |  |  | DataSet dss; | 
|---|
|  |  |  | dss = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Gy_RoutingBillMain"); | 
|---|
|  |  |  | //判断是否可编辑 | 
|---|
|  |  |  | if (dss.Tables[0].Rows[0]["HChecker"].ToString() != "" && dss.Tables[0].Rows[0]["HChecker"] != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "此单据已经被审核,不允许修改!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + HInterID, "Gy_RoutingBillMain"); | 
|---|
|  |  |  | //判断是否可编辑 | 
|---|
|  |  |  | if (dss.Tables[0].Rows[0]["number"].ToString() != "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "此单据已经被引用,不允许修改!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillMain  set " + | 
|---|
|  |  |  | "HDate='" + HDate + | 
|---|
|  |  |  | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + | 
|---|
|  |  |  | 
|---|
|  |  |  | foreach (Gy_RoutingBillSub oSub in DetailColl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配") | 
|---|
|  |  |  | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配" && oSystemParameter.omodel.WMS_CampanyName != "添康科技") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (oSub.HWorkQty <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | //计价方式不为计时,则把计时暂估字段更新为空 | 
|---|
|  |  |  | if (oSub.HIsTime == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillSub set HEstimate = null where HInterID = " + HInterID + " and HEntryID = " + i); | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillSub set HEstimate = 0 where HInterID = " + HInterID + " and HEntryID = " + i); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | //计价方式不为计时,则把计时暂估字段更新为空 | 
|---|
|  |  |  | if (oSub.HIsTime == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillSub set HEstimate = null where HInterID = " + HInterID + " and HEntryID = " + i); | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillSub set HEstimate = 0 where HInterID = " + HInterID + " and HEntryID = " + i); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (IsAudit == 0)  //审核判断 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("update Gy_RoutingBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID=" + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //刷新默认工艺路线 | 
|---|
|  |  |  | //oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | oCN.RunProc(sql04); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //更新单据的单据状态 | 
|---|
|  |  |  | if (oBill.CheckBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | if (oBill.CheckBill(oCN, oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Gy_RoutingBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = CodeConstant.SUCCEED; | 
|---|
|  |  |  | objJsonResult.count = CountConstant.SUCCEED; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | #region 反审核前的相关判断 | 
|---|
|  |  |  | //反审核前控制========================================= | 
|---|
|  |  |  | //DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Routing_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Gy_Routing_BeforeUnCheckCtrl"); | 
|---|
|  |  |  | //if (ds == null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = CodeConstant.FAIL; | 
|---|
|  |  |  | //    objJsonResult.count = CountConstant.FAIL; | 
|---|
|  |  |  | //    objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = CodeConstant.FAIL; | 
|---|
|  |  |  | //    objJsonResult.count = CountConstant.FAIL; | 
|---|
|  |  |  | //    objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Routing_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Gy_Routing_BeforeUnCheckCtrl"); | 
|---|
|  |  |  | if (ds == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = CodeConstant.FAIL; | 
|---|
|  |  |  | objJsonResult.count = CountConstant.FAIL; | 
|---|
|  |  |  | objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = CodeConstant.FAIL; | 
|---|
|  |  |  | objJsonResult.count = CountConstant.FAIL; | 
|---|
|  |  |  | objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //========================================================= | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|