using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; namespace BLL { public class ClsXt_CheckExtend_Ctl : DBUtility.ClsXt_BaseBill { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public ClsXt_CheckExtend_Model omodel = new ClsXt_CheckExtend_Model(); public ClsXt_CheckExtend_Ctl() { base.MvarItemKeySub = ""; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "A3_SeOrderBill_CheckExtend"; base.MvarReportTitle = "合同评审会签表"; base.BillType = ""; base.HBillSubType = ""; } //修改单据 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { return true; //try //{ // // // oCn.BeginTran(); // //更新主表 // oCn.RunProc("UpDate Kf_ICStockBillMain set " + // " HBillNo='" + omodel.HBillNo + "'" + //固定赋值=============== // ",HDate='" + omodel.HDate + "'" + // ",HYear='" + omodel.HYear.ToString() + "'" + // ",HPeriod='" + omodel.HPeriod.ToString() + "'" + // ",HRemark='" + omodel.HRemark + "'" + // ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + // ",HUpDateDate=getdate()" + // //======================================== // ",HSupID=" + omodel.HSupID.ToString() + // ",HWHID=" + omodel.HWHID.ToString() + // ",HSCWHID=" + omodel.HSCWHID.ToString() + // ",HManagerID=" + omodel.HMangerID.ToString() + // ",HSecManagerID=" + omodel.HSecManagerID.ToString() + // ",HKeeperID=" + omodel.HKeeperID.ToString() + // ",HDeptID=" + omodel.HDeptID.ToString() + // ",HExplanation='" + omodel.HExplanation + "'" + // ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + // ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + // " where HInterID=" + lngBillKey.ToString()); // //删除关联 // DeleteRelation(ref sReturn, lngBillKey); // //删除子表 // DeleteBillSub(lngBillKey); // //插入子表 // omodel.HInterID = lngBillKey; // foreach (Model.ClsKf_EntrustInBillSub oSub in DetailColl) // { // oCn.RunProc("Insert into Kf_ICStockBillSub " + // " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + // ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + // ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + // ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + // ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + // ") values(" // + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + // "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + // "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + // "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + // "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + // "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + // ") "); // } // // // //foreach (Model.ClsKf_EntrustInBillSub oSub in DetailColl) // //{ // // Ds = oCn.RunProcReturn("exec h_p_Kf_EntrustInBill_Qty " + oSub.HICMOInterID, ""); // // if (Ds.Tables[0].Rows.Count == 0) // // return; // // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") // // { // // sReturn = "汇报数量超过计划数量!不允许保存"; // // return false; // // } // //} // 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.HItemID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); //若MAINDI重复则重新获取 DataSet DsA; oCn.BeginTran(); //主表 oCn.RunProc("Insert Into A3_SeOrderBill_CheckExtend " + "(HBillNo,HCusNumber,HCommDate,HType,HTypeNote" + ",HSelType,HRequester,HRequestDate,HRequestNote,HStatus" + ") " + " values('" + omodel.HBillNo + "','" + omodel.HCusNumber + "','" + omodel.HCommDate.ToShortDateString() + "','" + omodel.HType + "','" + omodel.HTypeNote + "'" + ",'" + omodel.HSelType + "','" + omodel.HRequester + "','" + omodel.HRequestDate + "','" + omodel.HRequestNote + "'," + omodel.HStatus.ToString() + ") "); // DsA = oCn.RunProcReturn("exec h_p_GetNextChecker '" + omodel.HBillNo + "'", "Gy_Czygl"); if (DsA.Tables[0].Rows.Count == 0) { sReturn = "创建审核流失败!"; return false; } if (DBUtility.ClsPub.isLong(DsA.Tables[0].Rows[0][0]) != 99) { sReturn = DBUtility.ClsPub.isStrNull(DsA.Tables[0].Rows[0][1]); return false; } // sReturn = "新增单据成功!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } //显示单据 public bool ShowBill(string lngBillKey, ref string sReturn) { try { //查询主表 DataSet Ds; Ds = oCn.RunProcReturn("Select * from A3_SeOrderBill_CheckExtend Where HBillNo='" + lngBillKey + "'", "A3_SeOrderBill_CheckExtend"); if (Ds.Tables[0].Rows.Count == 0) { sReturn = "单据未找到!"; return false; } //固定赋值=========================================== omodel.HItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemID"]); omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]); omodel.HCusNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusNumber"]); omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]); omodel.HBackDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBackDate"]); omodel.HCommDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HCommDate"]); omodel.HType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HType"]); omodel.HTypeNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HTypeNote"]); omodel.HSelType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSelType"]); omodel.HRequester = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRequester"]); omodel.HRequestDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRequestDate"]).ToShortDateString(); omodel.HRequestNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRequestNote"]); omodel.HCheckItem = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckItem"]); omodel.HManager = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HManager"]); omodel.HManagerDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HManagerDate"]).ToShortDateString(); omodel.HManagerNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HManagerNote"]); omodel.HFstManager = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HFstManager"]); omodel.HFstManagerDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HFstManagerDate"]).ToShortDateString(); omodel.HFstManagerNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HFstManagerNote"]); omodel.HProdCheckDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HProdCheckDate"]); omodel.HProdMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProdMan"]); omodel.HProdManDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HProdManDate"]).ToShortDateString(); omodel.HProdManNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProdManNote"]); omodel.HLstRequesterCheckDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HLstRequesterCheckDate"]); omodel.HLstRequester = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstRequester"]); omodel.HLstRequesterDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HLstRequesterDate"]).ToShortDateString(); omodel.HLstRequesterNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstRequesterNote"]); omodel.HLstCommDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HLstCommDate"]); omodel.HRequesterSign = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRequesterSign"]); omodel.HRequesterSignDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRequesterSignDate"]).ToShortDateString(); omodel.HProdManSign = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProdManSign"]); omodel.HProdManSignDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HProdManSignDate"]).ToShortDateString(); omodel.HLstManager = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstManager"]); omodel.HLstManagerDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HLstManagerDate"]).ToShortDateString(); omodel.HLstManagerNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstManagerNote"]); omodel.HStatus = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HStatus"]); //======================================================== sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } public override bool DeleteBill(long lngBillKey, ref string sReturn) { try { oCn.BeginTran(); //删除主表 oCn.RunProc("Delete From A3_SeOrderBill_CheckExtend where HItemID=" + lngBillKey.ToString()); sReturn = "删除单据成功!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } //审核 public bool CheckBill(string lngBillKey, DateTime sDate, string sHCheckItem, string sNote, ref string sReturn) { try { DataSet DsA; DataSet Ds; string HChecker = DBUtility.ClsPub.CurUserName; Ds = oCn.RunProcReturn("exec h_p_A3_SeOrderBillExtend_Check '" + lngBillKey + "','" + sDate.ToShortDateString() + "','" + sHCheckItem + "','" + sNote + "','" + HChecker + "'", "Gy_Czygl"); if (Ds.Tables[0].Rows.Count == 0) { sReturn = "审核失败!"; return false; } sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]); // DsA = oCn.RunProcReturn("exec h_p_GetNextChecker '" + lngBillKey + "'", "Gy_Czygl"); if (DsA.Tables[0].Rows.Count == 0 || DsA == null) { sReturn = "创建审核流失败!"; return false; } if (DBUtility.ClsPub.isLong(DsA.Tables[0].Rows[0][0]) != 99) { sReturn = DBUtility.ClsPub.isStrNull(DsA.Tables[0].Rows[0][1]); return false; } return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //关闭 public bool CloseBill(string lngBillKey, ref string sReturn) { try { string HCloseMan = DBUtility.ClsPub.CurUserName; string HCloseDate = DBUtility.ClsPub.GetServerDate(-1); //oCn.RunProc(" Update A3_SeOrderBill_CheckExtend set HBacker='" + HCloseMan + "',HBackDate='" + HCloseDate + "' Where HBillNo='" + lngBillKey + "'"); oCn.RunProc(" Delete From A3_SeOrderBill_CheckExtend Where HBillNo='" + lngBillKey + "'"); DBUtility.ClsPub.Add_Log("", "退回订单:" + lngBillKey, DBUtility.ClsPub.CurUserName); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } } }