| | |
| | | lsmain = oListModels.getObjectByJson_Gy_Material(msg1); |
| | | |
| | | oBill.oModel = lsmain[0]; |
| | | LogService.Write("物料同步插件,保存方法执行完成异常:"+ msg1); |
| | | LogService.Write("物料:"+ msg1); |
| | | //保存 |
| | | bool bResult = oBill.AddNewApi(); |
| | | if (bResult) |
| | |
| | | } |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList " + sWhere + "order by 日期 desc", "h_v_Gy_MouldFileList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList " + sWhere + "order by 条码编号 desc", "h_v_Gy_MouldFileList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_MouldFileList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + "order by 日期 desc"; |
| | | string sql = sql1 + sWhere + "order by 条码编号 desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_MouldFileList"); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | /// <summary> |
| | | /// 新增模具档案-保存按钮 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | |
| | | #region[器具档案保存与修改保存方法] |
| | | [Route("Gy_Mould_Edit/AddBill")] |
| | | [HttpPost] |
| | | public object AddBill([FromBody] JObject oMain) |
| | |
| | | string HMouldUseStatus = mainList[0].HMouldUseStatus; |
| | | int HCREATEORGID = mainList[0].HCREATEORGID; |
| | | int HUSEORGID = mainList[0].HUSEORGID; |
| | | bool HTransPackFlag = mainList[0].HTransPackFlag; //周转容器标记 |
| | | bool HSendPackFlag = mainList[0].HSendPackFlag; //发货容器标记 |
| | | int HMouldLength = mainList[0].HMouldLength; //长 |
| | | int HMouldWidth = mainList[0].HMouldWidth; //宽 |
| | | int HMouldHeight = mainList[0].HMouldHeight; //高 |
| | | int HMouldFoldHeight = mainList[0].HMouldFoldHeight; //折叠高度 |
| | | |
| | | int HUserID = mainList[0].HUserID; // 使用人(Gy_Employee) |
| | | string HBrand = mainList[0].HBrand; // 品牌 |
| | | string HCalibrationType = mainList[0].HCalibrationType; // 校准类型 (内/外校) |
| | | string HLocation = mainList[0].HLocation; // 位置 |
| | | DateTime HCalibrationDate = mainList[0].HCalibrationDate; // 校准日期 |
| | | string HCalibrationCycle = mainList[0].HCalibrationCycle; // 校准周期 |
| | | string HProductDesignSize = mainList[0].HProductDesignSize; // 产品设计尺寸 |
| | | string HGaugeDesignSize = mainList[0].HGaugeDesignSize; // 检具设计尺寸 |
| | | int HProductQTY = mainList[0].HProductQTY; // 产品数量 |
| | | |
| | | //保存前控制========================================= |
| | | string HBillNote = ""; |
| | |
| | | ",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" + |
| | | ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" + |
| | | ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" + |
| | | ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus,HCREATEORGID,HUSEORGID) " + |
| | | " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + |
| | | ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus,HCREATEORGID,HUSEORGID " + |
| | | ",HMouldLength,HMouldWidth,HMouldHeight,HMouldFoldHeight,HTransPackFlag,HSendPackFlag," + |
| | | "HUserID,HBrand,HCalibrationType,HLocation,HCalibrationDate,HCalibrationCycle,HProductDesignSize,HGaugeDesignSize,HProductQTY ) " + |
| | | |
| | | " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" + |
| | | ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" + |
| | | ",'" + HSubjoin + "','" + HSubjoin2 + "','" + HPICNo + "','" + HWorkMaterModel + "'" + |
| | |
| | | "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty + |
| | | "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" + |
| | | ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID + |
| | | ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "',"+ HCREATEORGID + ","+ HUSEORGID + ") "); |
| | | ",'" + HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "'," + HCREATEORGID + "," + HUSEORGID + |
| | | "," + HMouldLength + "," + HMouldWidth + "," + HMouldHeight + "," + HMouldFoldHeight + "," + Convert.ToString(HTransPackFlag ? 1 : 0) + "," + Convert.ToString(HSendPackFlag ? 1 : 0) + "," + |
| | | "'" + HUserID + "','" + HBrand + "','" + HCalibrationType + "','" + HLocation + "','" + HCalibrationDate + "','" + HCalibrationCycle + "','" + HProductDesignSize + "','" + HGaugeDesignSize + "','" + HProductQTY + "') "); |
| | | |
| | | //子表 |
| | | oCN.RunProc("Insert into Gy_MouldFileSub " + |
| | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.HInterID = HInterID.ToString(); |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修改单据-保存按钮 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Gy_Mould_Edit/AddBill1")] |
| | | [HttpPost] |
| | | public object AddBill1([FromBody] JObject oMain) |
| | |
| | | string HMouldUseStatus = mainList[0].HMouldUseStatus; |
| | | int HUSEORGID = mainList[0].HUSEORGID; |
| | | DateTime HNextMainDate = mainList[0].HNextMainDate; |
| | | bool HTransPackFlag = mainList[0].HTransPackFlag; //周转容器标记 |
| | | bool HSendPackFlag = mainList[0].HSendPackFlag; //发货容器标记 |
| | | int HMouldLength = mainList[0].HMouldLength; //长 |
| | | int HMouldWidth = mainList[0].HMouldWidth; //宽 |
| | | int HMouldHeight = mainList[0].HMouldHeight; //高 |
| | | int HMouldFoldHeight = mainList[0].HMouldFoldHeight; //折叠高度 |
| | | |
| | | |
| | | int HUserID = mainList[0].HUserID; // 使用人(Gy_Employee) |
| | | string HBrand = mainList[0].HBrand; // 品牌 |
| | | string HCalibrationType = mainList[0].HCalibrationType; // 校准类型 (内/外校) |
| | | string HLocation = mainList[0].HLocation; // 位置 |
| | | DateTime HCalibrationDate = mainList[0].HCalibrationDate; // 校准日期 |
| | | string HCalibrationCycle = mainList[0].HCalibrationCycle; // 校准周期 |
| | | string HProductDesignSize = mainList[0].HProductDesignSize; // 产品设计尺寸 |
| | | string HGaugeDesignSize = mainList[0].HGaugeDesignSize; // 检具设计尺寸 |
| | | int HProductQTY = mainList[0].HProductQTY; // 产品数量 |
| | | |
| | | //若MAINDI重复则重新获取 |
| | | oCN.BeginTran(); |
| | | |
| | |
| | | } |
| | | //========================================================= |
| | | |
| | | //主表 |
| | | //主表 |
| | | oCN.RunProc("UpDate Gy_MouldFileMain set " + |
| | | " HBillNo='" + HBillNo + "'" + //固定赋值=============== |
| | | ",HDate='" + HDate + "'" + |
| | | ",HYear='" + HYear.ToString() + "'" + |
| | | ",HPeriod='" + HPeriod.ToString() + "'" + |
| | | ",HRemark='" + HRemark + "'" + |
| | | ",HUpDater='" + HUpDater + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | //======================================== |
| | | ",HMouldNo='" + HMouldNo + "'" + |
| | | ",HName='" + HName + "'" + |
| | | ",HModel='" + HModel + "'" + |
| | | ",HModel2='" + HModel2 + "'" + |
| | | ",HDiameter='" + HDiameter + "'" + |
| | | ",HSubjoin='" + HSubjoin + "'" + |
| | | ",HSubjoin2='" + HSubjoin2 + "'" + |
| | | ",HPICNo='" + HPICNo + "'" + |
| | | ",HWorkMaterModel='" + HWorkMaterModel + "'" + |
| | | ",HMaterID=" + HMaterID.ToString() + |
| | | ",HUSEORGID=" + HUSEORGID.ToString() + |
| | | ",HMaterNumber='" + HMaterNumber + "'" + |
| | | ",HMouldClass='" + HMouldClass + "'" + |
| | | ",HMouldType=" + HMouleTypeID.ToString() + |
| | | ",HUnitID=" + HUnitID.ToString() + |
| | | ",HOutComDate='" + HOutComDate + "'" + |
| | | ",HOutComNo='" + HOutComNo + "'" + |
| | | ",HDeptID=" + HDeptID.ToString() + |
| | | ",HSupID=" + HSupID.ToString() + |
| | | ",HSupNumber='" + HSupNumber + "'" + |
| | | ",HPrintQty=" + HPrintQty.ToString() + |
| | | ",HMouldStatus='" + HMouldStatus + "'" + |
| | | ",HSaveLife='" + HSaveLife + "'" + |
| | | ",HWhID=" + HWHID.ToString() + |
| | | ",HRoutingID=" + HRoutingID.ToString() + |
| | | ",HBomID=" + HBOMID.ToString() + |
| | | ",HVersion='" + HVersion + "'" + |
| | | ",HSPGroupID=" + HSPGroupID.ToString() + |
| | | ",HSPID=" + HSPID.ToString() + |
| | | ",HDesignLife=" + HDesignLife.ToString() + |
| | | ",HCaveQty=" + HCaveQty.ToString() + |
| | | ",HUseLife=" + HUseLife.ToString() + |
| | | ",HLeaveLife=" + HLeaveLife.ToString() + |
| | | ",HProdQty=" + HProdQty.ToString() + |
| | | ",HMouldDotCheckRuleInterID=" + HMouldDotCheckRuleInterID.ToString() + |
| | | ",HMouldMaintainRuleInterID=" + HMouldMaintainRuleInterID.ToString() + |
| | | ",HMouldOWNER='" + HMouldOWNER + "'" + |
| | | ",HNowSupID=" + HNowSupID.ToString() + |
| | | ",HNowSupTypeID=" + HNowSupTypeID.ToString() + |
| | | ",HProdWeight=" + HProdWeight.ToString() + |
| | | ",HBarCode='" + HBarCode.ToString() + "'" + |
| | | ",HMadeSupID=" + HMadeSupID + |
| | | ",HNowWHID=" + HNowWHID + |
| | | ",HNowSPID=" + HNowSPID + |
| | | ",HInitLife='" + HInitLife + |
| | | "',HNextMainDate='" + HNextMainDate + |
| | | "',HMouldUseStatus='" + HMouldUseStatus + |
| | | "' where HInterID=" + HInterID.ToString()); |
| | | |
| | | //修改子项目代码 |
| | | //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //将上级 为非末级 |
| | | // oCN.RunProc("Update Gy_Department set HEndflag=0 where HItemID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | " HBillNo='" + HBillNo + "'" + //固定赋值=============== |
| | | ",HDate='" + HDate + "'" + |
| | | ",HYear='" + HYear.ToString() + "'" + |
| | | ",HPeriod='" + HPeriod.ToString() + "'" + |
| | | ",HRemark='" + HRemark + "'" + |
| | | ",HUpDater='" + HUpDater + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | //======================================== |
| | | ",HMouldNo='" + HMouldNo + "'" + |
| | | ",HName='" + HName + "'" + |
| | | ",HModel='" + HModel + "'" + |
| | | ",HModel2='" + HModel2 + "'" + |
| | | ",HDiameter='" + HDiameter + "'" + |
| | | ",HSubjoin='" + HSubjoin + "'" + |
| | | ",HSubjoin2='" + HSubjoin2 + "'" + |
| | | ",HPICNo='" + HPICNo + "'" + |
| | | ",HWorkMaterModel='" + HWorkMaterModel + "'" + |
| | | ",HMaterID=" + HMaterID.ToString() + |
| | | ",HUSEORGID=" + HUSEORGID.ToString() + |
| | | ",HMaterNumber='" + HMaterNumber + "'" + |
| | | ",HMouldClass='" + HMouldClass + "'" + |
| | | ",HMouldType=" + HMouleTypeID.ToString() + |
| | | ",HUnitID=" + HUnitID.ToString() + |
| | | ",HOutComDate='" + HOutComDate + "'" + |
| | | ",HOutComNo='" + HOutComNo + "'" + |
| | | ",HDeptID=" + HDeptID.ToString() + |
| | | ",HSupID=" + HSupID.ToString() + |
| | | ",HSupNumber='" + HSupNumber + "'" + |
| | | ",HPrintQty=" + HPrintQty.ToString() + |
| | | ",HMouldStatus='" + HMouldStatus + "'" + |
| | | ",HSaveLife='" + HSaveLife + "'" + |
| | | ",HWhID=" + HWHID.ToString() + |
| | | ",HRoutingID=" + HRoutingID.ToString() + |
| | | ",HBomID=" + HBOMID.ToString() + |
| | | ",HVersion='" + HVersion + "'" + |
| | | ",HSPGroupID=" + HSPGroupID.ToString() + |
| | | ",HSPID=" + HSPID.ToString() + |
| | | ",HDesignLife=" + HDesignLife.ToString() + |
| | | ",HCaveQty=" + HCaveQty.ToString() + |
| | | ",HUseLife=" + HUseLife.ToString() + |
| | | ",HLeaveLife=" + HLeaveLife.ToString() + |
| | | ",HProdQty=" + HProdQty.ToString() + |
| | | ",HMouldDotCheckRuleInterID=" + HMouldDotCheckRuleInterID.ToString() + |
| | | ",HMouldMaintainRuleInterID=" + HMouldMaintainRuleInterID.ToString() + |
| | | ",HMouldOWNER='" + HMouldOWNER + "'" + |
| | | ",HNowSupID=" + HNowSupID.ToString() + |
| | | ",HNowSupTypeID=" + HNowSupTypeID.ToString() + |
| | | ",HProdWeight=" + HProdWeight.ToString() + |
| | | ",HBarCode='" + HBarCode.ToString() + "'" + |
| | | ",HMadeSupID=" + HMadeSupID + |
| | | ",HNowWHID=" + HNowWHID + |
| | | ",HNowSPID=" + HNowSPID + |
| | | ",HTransPackFlag=" + Convert.ToString(HTransPackFlag ? 1 : 0) + |
| | | ",HSendPackFlag=" + Convert.ToString(HSendPackFlag ? 1 : 0) + |
| | | ",HMouldLength=" + HMouldLength + |
| | | ",HMouldWidth=" + HMouldWidth + |
| | | ",HMouldHeight=" + HMouldHeight + |
| | | ",HMouldFoldHeight=" + HMouldFoldHeight + |
| | | ",HInitLife='" + HInitLife + |
| | | "',HNextMainDate='" + HNextMainDate + |
| | | "',HMouldUseStatus='" + HMouldUseStatus + |
| | | "',HUserID='" + HUserID + |
| | | "',HBrand='" + HBrand + |
| | | "',HCalibrationType='" + HCalibrationType + |
| | | "',HLocation='" + HLocation + |
| | | "',HCalibrationDate='" + HCalibrationDate + |
| | | "',HCalibrationCycle='" + HCalibrationCycle + |
| | | "',HProductDesignSize='" + HProductDesignSize + |
| | | "',HGaugeDesignSize='" + HGaugeDesignSize + |
| | | "',HProductQTY='" + HProductQTY + |
| | | "' where HInterID=" + HInterID.ToString()); |
| | | |
| | | oCN.RunProc("delete from Gy_MouldFileSub_SubMater where HInterID='" + HInterID + "'"); |
| | | oCN.RunProc("delete from Gy_MouldFileSub_MaintainRule where HInterID='" + HInterID + "'"); |
| | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "修改单据成功!"; |
| | | //objJsonResult.data = null; |
| | | objJsonResult.HInterID = HInterID.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 磨具档案修改按钮方法-计算下次保养/校正日期-获取档案最近一次的保养记录 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region [模具档案修改按钮方法-计算下次保养/校正日期-获取档案最近一次的保养记录] |
| | | [Route("Gy_Mould_Edit/calculateHNextMainDate")] |
| | | [HttpGet] |
| | | public object calculateHNextMainDate(long HInterID) |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 磨具档案修改按钮方法 |
| | |
| | | #region [同步基础资料] |
| | | [Route("Gy_Material/Gy_MaterialViewApi")] |
| | | [HttpGet] |
| | | public json Gy_MaterialViewApi(string Number, string Type) |
| | | public json Gy_MaterialViewApi(string Number, string Type, string HUseOrgID) |
| | | { |
| | | string sql = string.Empty; |
| | | string sReturn = ""; |
| | |
| | | { |
| | | #region [公有云模式,调用WEBAPI的方式进行更新] |
| | | var json = new |
| | | // { |
| | | // CreateOrgId = 0, |
| | | // Number = Number, |
| | | // Id = "" |
| | | // }; |
| | | { |
| | | CreateOrgId = 0, |
| | | Number = Number, |
| | | Id = "" |
| | | FormId= "BD_MATERIAL", |
| | | FieldKeys= "FMASTERID,FNUMBER,FNAME,FSPECIFICATION,FFORBIDSTATUS,FErpClsID,FBaseUnitId,FLENGTH,FWIDTH,FHEIGHT,FNETWEIGHT,FGROSSWEIGHT,FOldNumber,FSTOCKPLACEID,FPLANMODE,FCREATEDATE,FCREATEORGID,FUSEORGID,FISBATCHMANAGE,FCheckIncoming,FIsEnable1,FIsKFPeriod,FAuxUnitID,FSNUNIT,FBaseUnitId,FSaleUnitId,FSalePriceUnitId,FPerUnitStandHour,FStdLaborPrePareTime,FStdMachinePrepareTime", |
| | | FilterString= $@"FNUMBER='{Number}' AND FUSEORGID={HUseOrgID}", |
| | | OrderString= "", |
| | | TopRowCount= 0, |
| | | StartRow= 0, |
| | | Limit= 0 |
| | | }; |
| | | #region [金蝶部分] |
| | | //登录金蝶 |
| | | var loginRet = InvokeHelper.Login(); |
| | | |
| | | #region [金蝶部分] |
| | | //登录金蝶 |
| | | var loginRet = InvokeHelper.Login(); |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | //判断是否登录成功 |
| | | if (isSuccess < 0) |
| | |
| | | return objJsonResult; |
| | | } |
| | | //查看 获取数据 |
| | | var _result = InvokeHelper.View("BD_MATERIAL", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JObject.Parse(_result); |
| | | var _result = InvokeHelper.Query("BD_MATERIAL", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JArray.Parse(_result); |
| | | //判断数据是否获取成功 |
| | | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | // if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "金蝶物料同步失败jsonRoot:" + _result; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | if (_saveObj.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "金蝶物料同步失败jsonRoot:" + _result; |
| | | objJsonResult.Message = "金蝶客户同步失败,使用组织对应的物料代码无对应的物料"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | |
| | | #region [表数据赋值] |
| | | var jsonData = new |
| | | // { |
| | | // HItemID = _saveObj["Result"]["Result"]["Id"], |
| | | // HERPItemID = _saveObj["Result"]["Result"]["Id"], |
| | | // HNumber = _saveObj["Result"]["Result"]["Number"], |
| | | // HName = _saveObj["Result"]["Result"]["Name"][1]["Value"], |
| | | // HModel = _saveObj["Result"]["Result"]["Specification"][0]["Value"], |
| | | // HShortNumber = _saveObj["Result"]["Result"]["Number"], |
| | | // HParentID = 0, |
| | | // HLevel = 1, |
| | | // HEndFlag = 1, |
| | | // HStopflag = _saveObj["Result"]["Result"]["ForbidStatus"].ToString() == "A" ? 0 : 1 , |
| | | // HRemark = "CLD-ERP导入", |
| | | // HMaterClsID = _saveObj["Result"]["Result"]["MaterialBase"][0]["ErpClsID"], |
| | | // HUnitID = _saveObj["Result"]["Result"]["MaterialBase"][0]["BaseUnitId_Id"], |
| | | // HUnitGroupID = 0, |
| | | // HLength = _saveObj["Result"]["Result"]["MaterialBase"][0]["LENGTH"], |
| | | // HWidth = _saveObj["Result"]["Result"]["MaterialBase"][0]["WIDTH"], |
| | | // HHeight = _saveObj["Result"]["Result"]["MaterialBase"][0]["HEIGHT"], |
| | | // HJQty = _saveObj["Result"]["Result"]["MaterialBase"][0]["NETWEIGHT"], |
| | | // HMQty = _saveObj["Result"]["Result"]["MaterialBase"][0]["GROSSWEIGHT"], |
| | | // HOldMaterNumber = _saveObj["Result"]["Result"]["OldNumber"], |
| | | // HWHID = 0, |
| | | // HSPID = _saveObj["Result"]["Result"]["MaterialStock"][0]["StockPlaceId_Id"], |
| | | // HPlanMode = _saveObj["Result"]["Result"]["MaterialPlan"][0]["PlanMode"], |
| | | // HUseFlag = "未检验", |
| | | // HMakeTime = _saveObj["Result"]["Result"]["CreateDate"], |
| | | // HMinPickQty = 0, |
| | | // HCREATEORGID = _saveObj["Result"]["Result"]["CreateOrgId_Id"], |
| | | // HUSEORGID = _saveObj["Result"]["Result"]["UseOrgId_Id"], |
| | | // HBatchManager = _saveObj["Result"]["Result"]["MaterialStock"][0]["IsBatchManage"].ToString() == "false" ? 0 : 1, |
| | | // HCHECKINCOMING = _saveObj["Result"]["Result"]["MaterialQM"][0]["CheckIncoming"].ToString() == "false" ? 0 : 1, |
| | | // HAuxPropFlag = _saveObj["Result"]["Result"]["MaterialAuxPty"][0]["IsEnable1"].ToString() == "false" ? 0 : 1, |
| | | // HISKFPERIOD = _saveObj["Result"]["Result"]["MaterialStock"][0]["IsKFPeriod"].ToString() == "false" ? 0 : 1, |
| | | // HAuxUnitID = _saveObj["Result"]["Result"]["MaterialStock"][0]["AuxUnitID_Id"], |
| | | // HSNUnitID = _saveObj["Result"]["Result"]["MaterialStock"][0]["SNUnit_Id"], |
| | | // HBASEUNITID = _saveObj["Result"]["Result"]["MaterialBase"][0]["BaseUnitId_Id"], |
| | | // HSALEUNITID = _saveObj["Result"]["Result"]["MaterialSale"][0]["SaleUnitId_Id"], |
| | | // HSALEPRICEUNITID = _saveObj["Result"]["Result"]["MaterialSale"][0]["SalePriceUnitId_Id"], |
| | | // HPERUNITSTANDHOUR = _saveObj["Result"]["Result"]["MaterialProduce"][0]["PerUnitStandHour"], |
| | | // HSTDLABORPREPARETIME = _saveObj["Result"]["Result"]["MaterialProduce"][0]["StdLaborPrePareTime"], |
| | | // HSTDMACHINEPREPARETIME = _saveObj["Result"]["Result"]["MaterialProduce"][0]["StdMachinePrepareTime"] |
| | | // }; |
| | | { |
| | | HItemID = _saveObj["Result"]["Result"]["Id"], |
| | | HERPItemID = _saveObj["Result"]["Result"]["Id"], |
| | | HNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HName = _saveObj["Result"]["Result"]["Name"][1]["Value"], |
| | | HModel = _saveObj["Result"]["Result"]["Specification"][0]["Value"], |
| | | HShortNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HParentID = 0, |
| | | HLevel = 1, |
| | | HEndFlag = 1, |
| | | HStopflag = _saveObj["Result"]["Result"]["ForbidStatus"].ToString() == "A" ? 0 : 1 , |
| | | HRemark = "CLD-ERP导入", |
| | | HMaterClsID = _saveObj["Result"]["Result"]["MaterialBase"][0]["ErpClsID"], |
| | | HUnitID = _saveObj["Result"]["Result"]["MaterialBase"][0]["BaseUnitId_Id"], |
| | | HUnitGroupID = 0, |
| | | HLength = _saveObj["Result"]["Result"]["MaterialBase"][0]["LENGTH"], |
| | | HWidth = _saveObj["Result"]["Result"]["MaterialBase"][0]["WIDTH"], |
| | | HHeight = _saveObj["Result"]["Result"]["MaterialBase"][0]["HEIGHT"], |
| | | HJQty = _saveObj["Result"]["Result"]["MaterialBase"][0]["NETWEIGHT"], |
| | | HMQty = _saveObj["Result"]["Result"]["MaterialBase"][0]["GROSSWEIGHT"], |
| | | HOldMaterNumber = _saveObj["Result"]["Result"]["OldNumber"], |
| | | HWHID = 0, |
| | | HSPID = _saveObj["Result"]["Result"]["MaterialStock"][0]["StockPlaceId_Id"], |
| | | HPlanMode = _saveObj["Result"]["Result"]["MaterialPlan"][0]["PlanMode"], |
| | | HUseFlag = "未检验", |
| | | HMakeTime = _saveObj["Result"]["Result"]["CreateDate"], |
| | | HMinPickQty = 0, |
| | | HCREATEORGID = _saveObj["Result"]["Result"]["CreateOrgId_Id"], |
| | | HUSEORGID = _saveObj["Result"]["Result"]["UseOrgId_Id"], |
| | | HBatchManager = _saveObj["Result"]["Result"]["MaterialStock"][0]["IsBatchManage"].ToString() == "false" ? 0 : 1, |
| | | HCHECKINCOMING = _saveObj["Result"]["Result"]["MaterialQM"][0]["CheckIncoming"].ToString() == "false" ? 0 : 1, |
| | | HAuxPropFlag = _saveObj["Result"]["Result"]["MaterialAuxPty"][0]["IsEnable1"].ToString() == "false" ? 0 : 1, |
| | | HISKFPERIOD = _saveObj["Result"]["Result"]["MaterialStock"][0]["IsKFPeriod"].ToString() == "false" ? 0 : 1, |
| | | HAuxUnitID = _saveObj["Result"]["Result"]["MaterialStock"][0]["AuxUnitID_Id"], |
| | | HSNUnitID = _saveObj["Result"]["Result"]["MaterialStock"][0]["SNUnit_Id"], |
| | | HBASEUNITID = _saveObj["Result"]["Result"]["MaterialBase"][0]["BaseUnitId_Id"], |
| | | HSALEUNITID = _saveObj["Result"]["Result"]["MaterialSale"][0]["SaleUnitId_Id"], |
| | | HSALEPRICEUNITID = _saveObj["Result"]["Result"]["MaterialSale"][0]["SalePriceUnitId_Id"], |
| | | HPERUNITSTANDHOUR = _saveObj["Result"]["Result"]["MaterialProduce"][0]["PerUnitStandHour"], |
| | | HSTDLABORPREPARETIME = _saveObj["Result"]["Result"]["MaterialProduce"][0]["StdLaborPrePareTime"], |
| | | HSTDMACHINEPREPARETIME = _saveObj["Result"]["Result"]["MaterialProduce"][0]["StdMachinePrepareTime"] |
| | | HItemID = _saveObj[0][0], // 对应FMASTERID |
| | | HERPItemID = _saveObj[0][0], // 对应FMASTERID |
| | | HNumber = _saveObj[0][1], // 对应FNUMBER |
| | | HName = _saveObj[0][2], // 对应FNAME |
| | | HModel = _saveObj[0][3], // 对应FSPECIFICATION |
| | | HShortNumber = _saveObj[0][1], // 对应FNUMBER |
| | | HParentID = 0, |
| | | HLevel = 1, |
| | | HEndFlag = 1, |
| | | HStopflag = _saveObj[0][4].ToString() == "A" ? 0 : 1, // 对应FFORBIDSTATUS |
| | | HRemark = "CLD-ERP导入", |
| | | HMaterClsID = _saveObj[0][5], // 对应FErpClsID |
| | | HUnitID = _saveObj[0][6], // 对应FBaseUnitId |
| | | HUnitGroupID = 0, |
| | | HLength = _saveObj[0][7], // 对应FLENGTH |
| | | HWidth = _saveObj[0][8], // 对应FWIDTH |
| | | HHeight = _saveObj[0][9], // 对应FHEIGHT |
| | | HJQty = _saveObj[0][10], // 对应FNETWEIGHT |
| | | HMQty = _saveObj[0][11], // 对应FGROSSWEIGHT |
| | | HOldMaterNumber = _saveObj[0][12], // 对应FOldNumber |
| | | HWHID = 0, |
| | | HSPID = _saveObj[0][13], // 对应FSTOCKPLACEID |
| | | HPlanMode = _saveObj[0][14], // 对应FPLANMODE |
| | | HUseFlag = "未检验", |
| | | HMakeTime = _saveObj[0][15], // 对应FCREATEDATE |
| | | HMinPickQty = 0, |
| | | HCREATEORGID = _saveObj[0][16], // 对应FCREATEORGID |
| | | HUSEORGID = _saveObj[0][17], // 对应FUSEORGID |
| | | HBatchManager = (bool)_saveObj[0][18] ? 1 : 0, // 对应FISBATCHMANAGE |
| | | HCHECKINCOMING = (bool)_saveObj[0][19] ? 1 : 0, // 对应FCheckIncoming |
| | | HAuxPropFlag = (bool)_saveObj[0][20] ? 1 : 0, // 对应FIsEnable1 |
| | | HISKFPERIOD = (bool)_saveObj[0][21] ? 1 : 0, // 对应FIsKFPeriod |
| | | HAuxUnitID = _saveObj[0][22], // 对应FAuxUnitID |
| | | HSNUnitID = _saveObj[0][23], // 对应FSNUNIT |
| | | HBASEUNITID = _saveObj[0][24], // 对应FBaseUnitId |
| | | HSALEUNITID = _saveObj[0][25], // 对应FSaleUnitId |
| | | HSALEPRICEUNITID = _saveObj[0][26], // 对应FSalePriceUnitId |
| | | HPERUNITSTANDHOUR = _saveObj[0][27], // 对应FPerUnitStandHour |
| | | HSTDLABORPREPARETIME = _saveObj[0][28], // 对应FStdLaborPrePareTime |
| | | HSTDMACHINEPREPARETIME = _saveObj[0][29] // 对应FStdMachinePrepareTime |
| | | }; |
| | | #endregion |
| | | // 删除主表对应数据 |
| | |
| | | #region [模具档案批量生成] |
| | | [Route("Gy_Mould/SaveBatchGen_MouldFile")] |
| | | [HttpGet] |
| | | public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum) |
| | | public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum,string user) |
| | | { |
| | | int StarNum1 = int.Parse(StarNum); |
| | | int EndNum1 = int.Parse(EndNum); |
| | |
| | | ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID" + |
| | | ") " + |
| | | " values('3899','3899'," + HItemID + ",'" + Num1 + j + "',getdate()" + |
| | | "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + dr["HMaker"] + "',getdate(),'" + Num1 + j + |
| | | "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + user + "',getdate(),'" + Num1 + j + |
| | | "','" + Num1 + j + "','" + dr["HName"] + "','" + dr["HModel"] + "','" + dr["HModel2"] + "','" + dr["HDiameter"] + "'" + |
| | | ",'" + dr["HSubjoin"] + "','" + dr["HSubjoin2"] + "','" + dr["HPICNo"] + "','" + dr["HWorkMaterModel"] + "'" + |
| | | "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',0," + dr["HUnitID"] + |
| | | "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',"+dr["HMouldType"]+"," + dr["HUnitID"] + |
| | | ",'" + dr["HOutComDate"] + "','" + dr["HOutComNo"] + "'," + dr["HDeptID"] + "," + dr["HSupID"] + ",'" + dr["HSupNumber"] + "'" + |
| | | "," + dr["HPrintQty"] + ",'" + dr["HMouldStatus"] + "'," + dr["HWHID"] + "," + dr["HRoutingID"] + ",'" + dr["HCaveQty"] + |
| | | "'," + dr["HBOMID"] + ",'" + dr["HVersion"] + "'," + dr["HSPGroupID"] + "," + dr["HSPID"] + ",'" + dr["HDesignLife"] + "','" + dr["HNowSupID"] + "','" + dr["HNowSupTypeID"] + "'" + |
| | |
| | | if (!tb2.Columns.Contains("状态")) |
| | | error += "没有找到【状态】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("默认仓库")) |
| | | error += "没有找到【默认仓库】的标题,"; |
| | | //if (!tb2.Columns.Contains("默认仓库")) |
| | | // error += "没有找到【默认仓库】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("默认仓位")) |
| | | error += "没有找到【默认仓位】的标题,"; |
| | | //if (!tb2.Columns.Contains("默认仓位")) |
| | | // error += "没有找到【默认仓位】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("版本号")) |
| | | error += "没有找到【版本号】的标题,"; |
| | |
| | | { |
| | | tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | //查询仓库 |
| | | ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse"); |
| | | if (HWHName != "") |
| | | { |
| | | //查询仓库 |
| | | ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓库:" + HWHName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | string HWHID = tb2.Rows[i]["HWHID"].ToString(); |
| | | //查询仓位 |
| | | ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID+ " and HUSEORGID=" + HORGid + "", "Gy_Warehouse"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓库:" + HWHName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | |
| | | string HWHID = tb2.Rows[i]["HWHID"].ToString(); |
| | | if (HWHID != "") |
| | | { |
| | | //查询仓位 |
| | | ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID + " and HUSEORGID=" + HORGid + "", "Gy_StockPlace"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓位:" + HSPName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓位:" + HSPName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | if(HSupName!="") |
| | | { |
| | | tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,供应商:" + HSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | //查询供应商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | if(HMadeSupName!="") |
| | | { |
| | | //查询制造商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,供应商:" + HSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,制造商:" + HMadeSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | //查询制造商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,制造商:" + HMadeSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | |
| | | |
| | | |
| | | //器具档案名称 |
| | | if (HMouldName == "") |
| | |
| | | long HUnitID = int.Parse(item["HUnitID"].ToString()); |
| | | DateTime HOutComDate = DateTime.Now; |
| | | string HOutComNo = item["器具出厂编号"].ToString(); |
| | | long HDeptID = int.Parse(item["HDeptID"].ToString()); |
| | | long HSupID = int.Parse(item["HSupID"].ToString()); |
| | | var HDeptID_temp = item["HDeptID"].ToString() == "" ? "0" : item["HDeptID"].ToString(); |
| | | long HDeptID = int.Parse(HDeptID_temp); |
| | | var HSupID_temp = item["HSupID"].ToString() == "" ? "0" : item["HSupID"].ToString(); |
| | | long HSupID = int.Parse(HSupID_temp); |
| | | string HMouldStatus = item["状态"].ToString(); |
| | | long HWHID = int.Parse(item["HWHID"].ToString()); |
| | | var HWHID_TEMP = item["HWHID"].ToString() == "" ? "0" : item["HWHID"].ToString(); |
| | | long HWHID = int.Parse(HWHID_TEMP); |
| | | long HRoutingID = 0;//工艺路线id |
| | | long HBOMID = 0; |
| | | string HVersion = "";//版本 |
| | | long HSPGroupID = 0;//默认仓位组 |
| | | long HSPID = int.Parse(item["HSPID"].ToString());//仓位id |
| | | var HSPID_temp = item["HSPID"].ToString() == "" ? "0" : item["HSPID"].ToString(); |
| | | long HSPID = int.Parse(HSPID_temp);//仓位id |
| | | Double HDesignLife = item["设计寿命"].ToString()=="" ? 0: double.Parse(item["设计寿命"].ToString()); |
| | | Double HUseLife = item["使用寿命"].ToString() == "" ? 0 : double.Parse(item["使用寿命"].ToString()); |
| | | Double HInitLife = 0;//上线初始化寿命 |
| | |
| | | "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty + |
| | | "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" + |
| | | ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID + |
| | | ",'" + HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "') "); |
| | | ",'" + HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + " ) "); |
| | | } |
| | | else |
| | | { |
| | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 器具档案 文件上传 |
| | | [Route("Gy_MouldFileBIllMain/UploadFile_Gy_MouldFilen")] |
| | | [HttpPost] |
| | | public object UploadFile_Gy_MouldFilen() |
| | | { |
| | | |
| | | string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //单据号 |
| | | string HRemark = HttpContext.Current.Request.Params["HRemark"]; //备注 |
| | | string HUserName = HttpContext.Current.Request.Params["HUserName"]; //创建人 |
| | | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; |
| | | string path = HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HBillNo); |
| | | dynamic dyResult = UploadFile_Gy_MouldFilen(files, path, HBillNo, HRemark, HUserName); |
| | | if (dyResult != null && dyResult.result == 1) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "上传成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = dyResult.returnval; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | |
| | | public dynamic UploadFile_Gy_MouldFilen(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) |
| | | { |
| | | dynamic Result_Ob = new { result = 1, returnval = "上传成功!" }; |
| | | string filePath = Path.GetFullPath(files.FileName);//文件上传路径 |
| | | string fileExtension = Path.GetExtension(files.FileName);// 文件扩展名 |
| | | string filename = files.FileName;//文件名 |
| | | string fileSavePath = path;// 上传保存路径 |
| | | int filesize = files.ContentLength;//获取上传文件的大小单位为字节byte |
| | | int Maxsize = 40000 * 1024;//定义上传文件的最大空间大小为40M |
| | | try |
| | | { |
| | | if (files == null || files.ContentLength <= 0) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "文件不能为空!" }; |
| | | return Result_Ob; |
| | | } |
| | | if (filesize >= Maxsize) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传文件超过40M,不能上传!" }; |
| | | return Result_Ob; |
| | | } |
| | | |
| | | string fileurl = Path.Combine(fileSavePath, filename); |
| | | if (Directory.Exists(fileurl) == true) //如果存在重名文件就提示 |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "存在同名文件!" }; |
| | | return Result_Ob; |
| | | } |
| | | //删除数据表数据 |
| | | ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); |
| | | if (Directory.Exists(path)) |
| | | { |
| | | File.Delete(fileurl); //删除指定文件 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Directory.CreateDirectory(fileSavePath); //添加文件夹 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = e.Message }; |
| | | } |
| | | return Result_Ob; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据单据号查找上传文件列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_MouldFileBIllMain/Gy_MouldFilen_Filelist")] |
| | | [HttpGet] |
| | | public object Gy_MouldFilen_Filelist(string HBillNo) |
| | | { |
| | | var url = fileip + "/Files/Gy_MouldFilen/" + HBillNo + "/"; |
| | | |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据ID,单据号,文件名 删除文件 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_MouldFileBIllMain/Gy_MouldFilen_DeleteFilelist")] |
| | | [HttpGet] |
| | | public object Gy_MouldFilen_DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName) |
| | | { |
| | | try |
| | | { |
| | | |
| | | oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); |
| | | string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HSourceBillNo), HFileName); |
| | | File.Delete(fileurl); //删除指定文件 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | 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 |
| | | |
| | | |
| | | //根据条码找物料信息 |
| | | [Route("Gy_Material/findMaterialByNumber")] |
| | | [HttpGet] |
| | | public object findMaterialByNumber(string HbarCode,string HSTOCKORGID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查找失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "成功"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "初始化失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | [Route("Gy_BarCodeBillList/GetBarCodeBillPermission")] |
| | | [HttpGet] |
| | | public object GetBarCodeBillPermission(string user) |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBillList_Print", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限查询!"; |
| | | objJsonResult.data = 0; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |