/// <summary> /// 保存 /// </summary> private int SaveDeptCons() { if (this.neuSpread1_Sheet1.RowCount == 0) { MessageBox.Show(Language.Msg("没有可以保存的数据")); return(-1); } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance); //t.BeginTransaction(); phaConsManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); Neusoft.HISFC.Models.Pharmacy.DeptConstant deptConstant = null; for (int i = 0; i < this.neuSpread1_Sheet1.RowCount; i++) { deptConstant = new Neusoft.HISFC.Models.Pharmacy.DeptConstant(); deptConstant.ID = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColDeptID].Text; //部门编码 deptConstant.Name = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColDeptName].Text; //部门名称 deptConstant.IsStore = NConvert.ToBoolean(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColIsStore].Value.ToString()); //是否管理库存 deptConstant.IsBatch = NConvert.ToBoolean(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColIsBatch].Value.ToString()); //是否按批号管理 deptConstant.UnitFlag = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColUnitFlag].Text.ToString() == "包装单位" ? "1" : "0"; //库存管理默认单位:0最小单位,1包装单位 deptConstant.StoreMaxDays = NConvert.ToInt32(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColMaxDays].Text); //库存上限天数 deptConstant.StoreMinDays = NConvert.ToInt32(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColMinDays].Text); //库存下限天数 deptConstant.ReferenceDays = NConvert.ToInt32(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColReferenceDays].Text); //参考天数 deptConstant.IsArk = NConvert.ToBoolean(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColIsArk].Value.ToString()); //是否药柜管理 //{849BBA57-0A27-4e6b-BC8C-C92A9B9B325F} //deptConstant.InListNO = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColInListNO].Value.ToString(); //deptConstant.OutListNO = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColOutListNO].Value.ToString(); try { deptConstant.InListNO = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColInListNO].Value.ToString(); } catch (Exception) { deptConstant.InListNO = ""; } try { deptConstant.OutListNO = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColOutListNO].Value.ToString(); } catch (Exception) { deptConstant.OutListNO = ""; } int parm = this.phaConsManager.UpdateDeptConstant(deptConstant); if (parm == 0) { if (this.phaConsManager.InsertDeptConstant(deptConstant) != 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(Language.Msg(this.phaConsManager.Err)); return(-1); } } else if (parm == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(Language.Msg(this.phaConsManager.Err)); return(-1); } } Neusoft.FrameWork.Management.PublicTrans.Commit(); MessageBox.Show(Language.Msg("保存成功")); return(1); }